iris-pex-embedded-python 3.5.5b4__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.
- grongier/__init__.py +0 -0
- grongier/cls/Grongier/PEX/BusinessOperation.cls +8 -0
- grongier/cls/Grongier/PEX/BusinessProcess.cls +13 -0
- grongier/cls/Grongier/PEX/BusinessService.cls +8 -0
- grongier/cls/Grongier/PEX/Common.cls +10 -0
- grongier/cls/Grongier/PEX/Director.cls +10 -0
- grongier/cls/Grongier/PEX/Duplex/Operation.cls +4 -0
- grongier/cls/Grongier/PEX/Duplex/Process.cls +13 -0
- grongier/cls/Grongier/PEX/Duplex/Service.cls +4 -0
- grongier/cls/Grongier/PEX/InboundAdapter.cls +8 -0
- grongier/cls/Grongier/PEX/Message.cls +13 -0
- grongier/cls/Grongier/PEX/OutboundAdapter.cls +8 -0
- grongier/cls/Grongier/PEX/PickleMessage.cls +13 -0
- grongier/cls/Grongier/PEX/PrivateSession/Duplex.cls +8 -0
- grongier/cls/Grongier/PEX/PrivateSession/Message/Ack.cls +14 -0
- grongier/cls/Grongier/PEX/PrivateSession/Message/Poll.cls +14 -0
- grongier/cls/Grongier/PEX/PrivateSession/Message/Start.cls +14 -0
- grongier/cls/Grongier/PEX/PrivateSession/Message/Stop.cls +14 -0
- grongier/cls/Grongier/PEX/Test.cls +10 -0
- grongier/cls/Grongier/PEX/Utils.cls +10 -0
- grongier/cls/Grongier/Service/WSGI.cls +4 -0
- grongier/pex/__init__.py +24 -0
- grongier/pex/__main__.py +4 -0
- grongier/pex/_business_host.py +1 -0
- grongier/pex/_cli.py +4 -0
- grongier/pex/_common.py +1 -0
- grongier/pex/_director.py +1 -0
- grongier/pex/_utils.py +1 -0
- grongier/pex/wsgi/handlers.py +104 -0
- iop/__init__.py +25 -0
- iop/__main__.py +4 -0
- iop/_async_request.py +67 -0
- iop/_business_host.py +256 -0
- iop/_business_operation.py +75 -0
- iop/_business_process.py +224 -0
- iop/_business_service.py +63 -0
- iop/_cli.py +247 -0
- iop/_common.py +334 -0
- iop/_debugpy.py +187 -0
- iop/_decorators.py +49 -0
- iop/_director.py +301 -0
- iop/_dispatch.py +136 -0
- iop/_generator_request.py +30 -0
- iop/_inbound_adapter.py +34 -0
- iop/_iris.py +8 -0
- iop/_log_manager.py +100 -0
- iop/_message.py +40 -0
- iop/_message_validator.py +49 -0
- iop/_outbound_adapter.py +23 -0
- iop/_private_session_duplex.py +103 -0
- iop/_private_session_process.py +41 -0
- iop/_remote.py +91 -0
- iop/_serialization.py +199 -0
- iop/_utils.py +671 -0
- iop/cls/IOP/BusinessOperation.cls +35 -0
- iop/cls/IOP/BusinessProcess.cls +156 -0
- iop/cls/IOP/BusinessService.cls +40 -0
- iop/cls/IOP/Common.cls +569 -0
- iop/cls/IOP/Director.cls +70 -0
- iop/cls/IOP/Duplex/Operation.cls +29 -0
- iop/cls/IOP/Duplex/Process.cls +229 -0
- iop/cls/IOP/Duplex/Service.cls +9 -0
- iop/cls/IOP/Generator/Message/Ack.cls +31 -0
- iop/cls/IOP/Generator/Message/Poll.cls +31 -0
- iop/cls/IOP/Generator/Message/Start.cls +15 -0
- iop/cls/IOP/Generator/Message/StartPickle.cls +15 -0
- iop/cls/IOP/Generator/Message/Stop.cls +32 -0
- iop/cls/IOP/InboundAdapter.cls +22 -0
- iop/cls/IOP/Message/JSONSchema.cls +125 -0
- iop/cls/IOP/Message.cls +754 -0
- iop/cls/IOP/OutboundAdapter.cls +36 -0
- iop/cls/IOP/PickleMessage.cls +58 -0
- iop/cls/IOP/PrivateSession/Duplex.cls +260 -0
- iop/cls/IOP/PrivateSession/Message/Ack.cls +32 -0
- iop/cls/IOP/PrivateSession/Message/Poll.cls +32 -0
- iop/cls/IOP/PrivateSession/Message/Start.cls +31 -0
- iop/cls/IOP/PrivateSession/Message/Stop.cls +48 -0
- iop/cls/IOP/Projection.cls +49 -0
- iop/cls/IOP/Service/Remote/Handler.cls +30 -0
- iop/cls/IOP/Service/Remote/Rest/v1.cls +97 -0
- iop/cls/IOP/Service/WSGI.cls +310 -0
- iop/cls/IOP/Test.cls +85 -0
- iop/cls/IOP/Utils.cls +503 -0
- iop/cls/IOP/Wrapper.cls +58 -0
- iop/wsgi/handlers.py +104 -0
- iris_pex_embedded_python-3.5.5b4.dist-info/METADATA +91 -0
- iris_pex_embedded_python-3.5.5b4.dist-info/RECORD +91 -0
- iris_pex_embedded_python-3.5.5b4.dist-info/WHEEL +5 -0
- iris_pex_embedded_python-3.5.5b4.dist-info/entry_points.txt +2 -0
- iris_pex_embedded_python-3.5.5b4.dist-info/licenses/LICENSE +21 -0
- iris_pex_embedded_python-3.5.5b4.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,36 @@
|
|
|
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 IOP.OutboundAdapter Extends (Ens.OutboundAdapter, IOP.Common) [ Inheritance = right, ProcedureBlock, System = 4 ]
|
|
6
|
+
{
|
|
7
|
+
|
|
8
|
+
Property KeepaliveInterval As %Numeric [ InitialExpression = 0 ];
|
|
9
|
+
|
|
10
|
+
Parameter SETTINGS = "KeepaliveInterval:Python CallInterval,%classname:Python OutboundAdapter,%module:Python OutboundAdapter,%settings:Python OutboundAdapter,%classpaths:Python OutboundAdapter";
|
|
11
|
+
|
|
12
|
+
Method %DispatchMethod(
|
|
13
|
+
method As %String,
|
|
14
|
+
args...) As %ObjectHandle
|
|
15
|
+
{
|
|
16
|
+
if $quit {
|
|
17
|
+
quit $method($this.%class,method,args...)
|
|
18
|
+
} else {
|
|
19
|
+
do $method($this.%class,method,args...)
|
|
20
|
+
quit
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
Method OnKeepalive(pStatus As %Status = {$$$OK}) As %Status
|
|
25
|
+
{
|
|
26
|
+
set tSC = $$$OK
|
|
27
|
+
try {
|
|
28
|
+
$$$ThrowOnError(##super(pStatus))
|
|
29
|
+
do ..%class."on_keepalive"()
|
|
30
|
+
} catch ex {
|
|
31
|
+
set tSC = ..DisplayTraceback(ex)
|
|
32
|
+
}
|
|
33
|
+
quit tSC
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
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 IOP.PickleMessage Extends (Ens.MessageBody, %CSP.Page)
|
|
6
|
+
{
|
|
7
|
+
|
|
8
|
+
Property classname As %String(MAXLEN = "");
|
|
9
|
+
|
|
10
|
+
Property jstr As %Stream.GlobalCharacter [ Internal, Private ];
|
|
11
|
+
|
|
12
|
+
Method %OnNew(classname) As %Status [ Private, ServerOnly = 1 ]
|
|
13
|
+
{
|
|
14
|
+
set ..classname = $g(classname)
|
|
15
|
+
Quit $$$OK
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/// This method is called by the Management Portal to determine the content type that will be returned by the <method>%ShowContents</method> method.
|
|
19
|
+
/// The return value is a string containing an HTTP content type.
|
|
20
|
+
Method %GetContentType() As %String
|
|
21
|
+
{
|
|
22
|
+
Quit "text/html"
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/// This method is called by the Management Portal to display a message-specific content viewer.<br>
|
|
26
|
+
/// This method displays its content by writing out to the current device.
|
|
27
|
+
/// The content should match the type returned by the <method>%GetContentType</method> method.<br>
|
|
28
|
+
Method %ShowContents(pZenOutput As %Boolean = 0)
|
|
29
|
+
{
|
|
30
|
+
// https://github.com/bazh/jquery.json-view
|
|
31
|
+
&html<<div id="element">#(..classname)#</div>>
|
|
32
|
+
&html<<div>Pickle Pyhton Message can't be displayed</div>>
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
Storage Default
|
|
36
|
+
{
|
|
37
|
+
<Data name="MessageDefaultData">
|
|
38
|
+
<Subscript>"Message"</Subscript>
|
|
39
|
+
<Value name="1">
|
|
40
|
+
<Value>classname</Value>
|
|
41
|
+
</Value>
|
|
42
|
+
<Value name="2">
|
|
43
|
+
<Value>json</Value>
|
|
44
|
+
</Value>
|
|
45
|
+
<Value name="3">
|
|
46
|
+
<Value>jstr</Value>
|
|
47
|
+
</Value>
|
|
48
|
+
</Data>
|
|
49
|
+
<Data name="jsonObject">
|
|
50
|
+
<Attribute>jsonObject</Attribute>
|
|
51
|
+
<Structure>node</Structure>
|
|
52
|
+
<Subscript>"IOP.Message.jsonObject"</Subscript>
|
|
53
|
+
</Data>
|
|
54
|
+
<DefaultData>MessageDefaultData</DefaultData>
|
|
55
|
+
<Type>%Storage.Persistent</Type>
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/* Copyright (c) 2022 by InterSystems Corporation.
|
|
2
|
+
Cambridge, Massachusetts, U.S.A. All rights reserved.
|
|
3
|
+
Confidential property of InterSystems Corporation. */
|
|
4
|
+
|
|
5
|
+
Class IOP.PrivateSessionDuplex Extends (IOP.Common, Ens.BusinessDuplex) [ Abstract, System = 4 ]
|
|
6
|
+
{
|
|
7
|
+
|
|
8
|
+
/// Domain for error messages
|
|
9
|
+
Parameter DOMAIN = "PrivateSession";
|
|
10
|
+
|
|
11
|
+
Parameter SETTINGS = "DuplexTargetConfigName,%classname:Python BusinessProcess,%module:Python BusinessProcess,%settings:Python BusinessProcess,%classpaths:Python BusinessProcess";
|
|
12
|
+
|
|
13
|
+
/// Configuration item(s) to which to send messages
|
|
14
|
+
Property DuplexTargetConfigName As %String(MAXLEN = 1000);
|
|
15
|
+
|
|
16
|
+
/// This holds the deferred response token
|
|
17
|
+
Property DeferredResponseToken As %String;
|
|
18
|
+
|
|
19
|
+
/// This holds data that is not yet ready for processing
|
|
20
|
+
Property ReceivedDataQueue As list Of %Library.Persistent;
|
|
21
|
+
|
|
22
|
+
/// This method is called by the TCP Adapter when a message is received.
|
|
23
|
+
Method OnProcessInput(
|
|
24
|
+
pInput As %Persistent,
|
|
25
|
+
Output pOutput As %Persistent,
|
|
26
|
+
ByRef pHint As %String) As %Status
|
|
27
|
+
{
|
|
28
|
+
set tSC = $$$OK
|
|
29
|
+
try {
|
|
30
|
+
try {
|
|
31
|
+
set ..%class."_wait_for_next_call_interval" = ..%WaitForNextCallInterval
|
|
32
|
+
}catch {}
|
|
33
|
+
set pOutput = ..%class."_dispatch_on_process_input"(pInput)
|
|
34
|
+
try {
|
|
35
|
+
set ..%WaitForNextCallInterval = ..%class."_wait_for_next_call_interval"
|
|
36
|
+
}catch {}
|
|
37
|
+
} catch ex {
|
|
38
|
+
set tSC = ex.AsStatus()
|
|
39
|
+
}
|
|
40
|
+
quit tSC
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
Method dispatchSendDocumentToProcess(pDocument) As %String
|
|
44
|
+
{
|
|
45
|
+
set tSC = ..SendDocumentToProcess(pDocument)
|
|
46
|
+
if $$$ISERR(tSC) throw ##class(%Exception.StatusException).CreateFromStatus(tSC)
|
|
47
|
+
quit
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
Method SendDocumentToProcess(pDocument As %Library.Persistent) As %Status
|
|
51
|
+
{
|
|
52
|
+
#dim tSC As %Status = $$$OK
|
|
53
|
+
try {
|
|
54
|
+
If '..%InPrivateSession Set tSC=..StartPrivateSession() Quit:$$$ISERR(tSC)
|
|
55
|
+
If ..DeferredResponseToken'="" {
|
|
56
|
+
Set tSC=..SendDeferredResponse(..DeferredResponseToken,pDocument) If $$$ISERR(tSC) Quit
|
|
57
|
+
Set ..DeferredResponseToken=""
|
|
58
|
+
} else {
|
|
59
|
+
Do ..ReceivedDataQueue.Insert(pDocument)
|
|
60
|
+
}
|
|
61
|
+
} catch {
|
|
62
|
+
Set tSC=$$$EnsSystemError
|
|
63
|
+
}
|
|
64
|
+
Quit tSC
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
Method StartPrivateSession() As %Status
|
|
68
|
+
{
|
|
69
|
+
#dim tSC As %Status = $$$OK
|
|
70
|
+
try {
|
|
71
|
+
If ..%InPrivateSession Quit
|
|
72
|
+
Set tSC = ..RegisterPrivateSession() Quit:$$$ISERR(tSC)
|
|
73
|
+
Set tSC=..SendRequestAsync(..DuplexTargetConfigName,##class(IOP.PrivateSession.Message.Start).%New()) Quit:$$$ISERR(tSC)
|
|
74
|
+
Set tSC = ..OnPrivateSessionStarted(1) Quit:$$$ISERR(tSC)
|
|
75
|
+
} catch {
|
|
76
|
+
Set tSC=$$$EnsSystemError
|
|
77
|
+
}
|
|
78
|
+
Quit tSC
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
Method StopPrivateSession(pAttachedMessage As %Persistent = "") As %Status
|
|
82
|
+
{
|
|
83
|
+
#dim tSC As %Status = $$$OK
|
|
84
|
+
#dim tMessageHeaderId As %String
|
|
85
|
+
#dim tRequestHeader As Ens.MessageHeader
|
|
86
|
+
try {
|
|
87
|
+
If ..%InPrivateSession {
|
|
88
|
+
#; Target might receive stop message before this job unregisters and therefore need to remove queue pointer
|
|
89
|
+
If ..DeferredResponseToken'="" {
|
|
90
|
+
try {
|
|
91
|
+
Set tMessageHeaderId=$p(..DeferredResponseToken,"|",1)
|
|
92
|
+
Set tRequestHeader=##Class(Ens.MessageHeader).%OpenId(tMessageHeaderId,,.tSC) Quit:$$$ISERR(tSC)
|
|
93
|
+
If $$$ConfigSessionQueueName(..%ConfigName,..%PrivateSessionId)'=tRequestHeader.ReturnQueueName {
|
|
94
|
+
Kill $$$ConfigSessionQueueName(..%ConfigName,..%PrivateSessionId)
|
|
95
|
+
}
|
|
96
|
+
Set tRequestHeader=""
|
|
97
|
+
} catch {}
|
|
98
|
+
}
|
|
99
|
+
Set tSC=..SendDocumentToProcess(##class(IOP.PrivateSession.Message.Stop).%New(pAttachedMessage)) Quit:$$$ISERR(tSC)
|
|
100
|
+
Set tSC=..UnRegisterPrivateSession()
|
|
101
|
+
set ..DeferredResponseToken=""
|
|
102
|
+
|
|
103
|
+
#; Ensure all messages are delivered including STOP message (JN1098)
|
|
104
|
+
#; Do ..ReceivedDataQueue.Clear()
|
|
105
|
+
Set tSC=..OnPrivateSessionStopped(1) Quit:$$$ISERR(tSC)
|
|
106
|
+
}
|
|
107
|
+
} catch {
|
|
108
|
+
Set tSC=$$$EnsSystemError
|
|
109
|
+
}
|
|
110
|
+
Quit tSC
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
Method RegisterPrivateSession() As %Status
|
|
114
|
+
{
|
|
115
|
+
If ..%InPrivateSession Quit $$$OK
|
|
116
|
+
If ..%SessionId="" Set tSC=..ForceSessionId() Quit:$$$ISERR(tSC) tSC
|
|
117
|
+
Set ..%PrivateSessionId=..%SessionId
|
|
118
|
+
Set tSC = ##class(Ens.Queue).Create(..QueueName()) Quit:$$$ISERR(tSC) tSC
|
|
119
|
+
|
|
120
|
+
try {
|
|
121
|
+
Set tSC=..Adapter.OpenEventDevice()
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
Set $$$ConfigSessionQueueName(..%ConfigName,..%SessionId)=..QueueName()
|
|
128
|
+
$$$sysTRACE("Registered Private Session '"_..%PrivateSessionId_"'")
|
|
129
|
+
Quit $$$OK
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
Method UnRegisterPrivateSession() As %Status
|
|
133
|
+
{
|
|
134
|
+
If '..%InPrivateSession Quit $$$OK
|
|
135
|
+
Kill $$$ConfigSessionQueueName(..%ConfigName,..%PrivateSessionId)
|
|
136
|
+
try {
|
|
137
|
+
Set tSC=..Adapter.CloseEventDevice()
|
|
138
|
+
}
|
|
139
|
+
catch {
|
|
140
|
+
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
Set tSC=##class(Ens.Queue).Delete(..QueueName(),"*") Quit:$$$ISERR(tSC) tSC
|
|
144
|
+
$$$sysTRACE("Unregistered Private Session '"_..%PrivateSessionId_"'")
|
|
145
|
+
Set ..%PrivateSessionId=""
|
|
146
|
+
Set ..%SessionId=""
|
|
147
|
+
Kill $$$JobSessionId
|
|
148
|
+
Quit $$$OK
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
XData MessageMap
|
|
152
|
+
{
|
|
153
|
+
<MapItems>
|
|
154
|
+
<MapItem MessageType="IOP.PrivateSession.Message.Start"><Method>OnMsgPrivateSessionStart</Method></MapItem>
|
|
155
|
+
<MapItem MessageType="IOP.PrivateSession.Message.Stop"><Method>OnMsgPrivateSessionStop</Method></MapItem>
|
|
156
|
+
<MapItem MessageType="IOP.PrivateSession.Message.Poll"><Method>OnMsgPrivateSessionPoll</Method></MapItem>
|
|
157
|
+
</MapItems>
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
Method OnMsgPrivateSessionStart(
|
|
161
|
+
pRequest As IOP.PrivateSession.Message.Start,
|
|
162
|
+
Output pResponse As %Library.Persistent) As %Status
|
|
163
|
+
{
|
|
164
|
+
#dim tSC As %Status = $$$OK
|
|
165
|
+
try {
|
|
166
|
+
Set tSC=..RegisterPrivateSession() Quit:$$$ISERR(tSC)
|
|
167
|
+
Set tSC=..OnPrivateSessionStarted(0) Quit:$$$ISERR(tSC)
|
|
168
|
+
Kill %objlasterror Set pResponse=##class(IOP.PrivateSession.Message.Ack).%New()
|
|
169
|
+
If '$IsObject(pResponse) Set tSC=$$$ERROR($$$FailedToNewClass,"IOP.PrivateSession.Message.Ack") Quit
|
|
170
|
+
} catch {
|
|
171
|
+
Set tSC=$$$EnsSystemError
|
|
172
|
+
}
|
|
173
|
+
Quit tSC
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
Method OnMsgPrivateSessionStop(
|
|
177
|
+
pRequest As IOP.PrivateSession.Message.Stop,
|
|
178
|
+
Output pResponse As %Library.Persistent) As %Status
|
|
179
|
+
{
|
|
180
|
+
#dim tSC As %Status = $$$OK
|
|
181
|
+
try {
|
|
182
|
+
Set tSC=..UnRegisterPrivateSession() Quit:$$$ISERR(tSC)
|
|
183
|
+
set ..DeferredResponseToken=""
|
|
184
|
+
do ..ReceivedDataQueue.Clear()
|
|
185
|
+
Set tSC=..OnPrivateSessionStopped(0,pRequest.AttachedMessage) Quit:$$$ISERR(tSC)
|
|
186
|
+
} catch {
|
|
187
|
+
Set tSC=$$$EnsSystemError
|
|
188
|
+
}
|
|
189
|
+
Quit tSC
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
Method OnMsgPrivateSessionPoll(
|
|
193
|
+
pPollIn As IOP.PrivateSession.Message.Poll,
|
|
194
|
+
Output pResponse As %Library.Persistent) As %Status
|
|
195
|
+
{
|
|
196
|
+
#dim tSC As %Status = $$$OK
|
|
197
|
+
#dim tToken As %String
|
|
198
|
+
try {
|
|
199
|
+
If ..ReceivedDataQueue.Count() {
|
|
200
|
+
Set pResponse=..ReceivedDataQueue.GetAt(1)
|
|
201
|
+
do ..ReceivedDataQueue.RemoveAt(1)
|
|
202
|
+
} Else {
|
|
203
|
+
Set tSC=..DeferResponse(.tToken) If $$$ISERR(tSC) Quit
|
|
204
|
+
Set ..DeferredResponseToken=tToken
|
|
205
|
+
}
|
|
206
|
+
} catch {
|
|
207
|
+
Set tSC=$$$EnsSystemError
|
|
208
|
+
}
|
|
209
|
+
Quit tSC
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/// Return an array of connections for drawing lines on the config diagram
|
|
213
|
+
ClassMethod OnGetConnections(
|
|
214
|
+
Output pArray As %String,
|
|
215
|
+
pItem As Ens.Config.Item)
|
|
216
|
+
{
|
|
217
|
+
Do ##super(.pArray,pItem)
|
|
218
|
+
If pItem.GetModifiedSetting("DuplexTargetConfigName",.tValue) {
|
|
219
|
+
Set tOne=$ZStrip(tValue,"<>W")
|
|
220
|
+
Set:""'=tOne pArray(tOne)=""
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
Method OnPrivateSessionStarted(pSelfGenerated As %Boolean) As %Status
|
|
225
|
+
{
|
|
226
|
+
set tSC = $$$OK
|
|
227
|
+
try {
|
|
228
|
+
set response = ..%class."_dispatch_on_private_session_started"($this,pSelfGenerated)
|
|
229
|
+
} catch ex {
|
|
230
|
+
set tSC = ex.AsStatus()
|
|
231
|
+
}
|
|
232
|
+
quit tSC
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
Method OnPrivateSessionStopped(
|
|
236
|
+
pSelfGenerated As %Boolean,
|
|
237
|
+
pAttachedMessage As %Persistent = "") As %Status
|
|
238
|
+
{
|
|
239
|
+
set tSC = $$$OK
|
|
240
|
+
try {
|
|
241
|
+
set response = ..%class."_dispatch_on_private_session_stopped"($this,pSelfGenerated,pAttachedMessage)
|
|
242
|
+
} catch ex {
|
|
243
|
+
set tSC = ex.AsStatus()
|
|
244
|
+
}
|
|
245
|
+
quit tSC
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
Method OnTearDown() As %Status
|
|
249
|
+
{
|
|
250
|
+
#dim tSC As %Status = $$$OK
|
|
251
|
+
try {
|
|
252
|
+
If ..%InPrivateSession Set tSC=..StopPrivateSession() Quit:$$$ISERR(tSC)
|
|
253
|
+
do ..%class."_dispatch_on_tear_down"()
|
|
254
|
+
} catch {
|
|
255
|
+
Set tSC=$$$EnsSystemError
|
|
256
|
+
}
|
|
257
|
+
Quit tSC
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* Copyright (c) 2022 by InterSystems Corporation.
|
|
2
|
+
Cambridge, Massachusetts, U.S.A. All rights reserved.
|
|
3
|
+
Confidential property of InterSystems Corporation. */
|
|
4
|
+
|
|
5
|
+
/// This class is a DICOM framework class
|
|
6
|
+
Class IOP.PrivateSession.Message.Ack Extends (%Persistent, Ens.Util.MessageBodyMethods) [ ClassType = persistent, Inheritance = right, ProcedureBlock, System = 4 ]
|
|
7
|
+
{
|
|
8
|
+
|
|
9
|
+
Parameter DOMAIN = "PrivateSession";
|
|
10
|
+
|
|
11
|
+
/// From 'Ens.Util.MessageBodyMethods'
|
|
12
|
+
Method %ShowContents(pZenOutput As %Boolean = 0)
|
|
13
|
+
{
|
|
14
|
+
Write $$$Text("(session-ack)")
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
Storage Default
|
|
18
|
+
{
|
|
19
|
+
<Data name="AckDefaultData">
|
|
20
|
+
<Value name="1">
|
|
21
|
+
<Value>%%CLASSNAME</Value>
|
|
22
|
+
</Value>
|
|
23
|
+
</Data>
|
|
24
|
+
<DataLocation>^IOP.PrivateSe9756.AckD</DataLocation>
|
|
25
|
+
<DefaultData>AckDefaultData</DefaultData>
|
|
26
|
+
<IdLocation>^IOP.PrivateSe9756.AckD</IdLocation>
|
|
27
|
+
<IndexLocation>^IOP.PrivateSe9756.AckI</IndexLocation>
|
|
28
|
+
<StreamLocation>^IOP.PrivateSe9756.AckS</StreamLocation>
|
|
29
|
+
<Type>%Storage.Persistent</Type>
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* Copyright (c) 2022 by InterSystems Corporation.
|
|
2
|
+
Cambridge, Massachusetts, U.S.A. All rights reserved.
|
|
3
|
+
Confidential property of InterSystems Corporation. */
|
|
4
|
+
|
|
5
|
+
/// This class is a DICOM framework class
|
|
6
|
+
Class IOP.PrivateSession.Message.Poll Extends (%Persistent, Ens.Util.MessageBodyMethods) [ ClassType = persistent, Inheritance = right, ProcedureBlock, System = 4 ]
|
|
7
|
+
{
|
|
8
|
+
|
|
9
|
+
Parameter DOMAIN = "PrivateSession";
|
|
10
|
+
|
|
11
|
+
/// From 'Ens.Util.MessageBodyMethods'
|
|
12
|
+
Method %ShowContents(pZenOutput As %Boolean = 0)
|
|
13
|
+
{
|
|
14
|
+
Write $$$Text("(poll-data)")
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
Storage Default
|
|
18
|
+
{
|
|
19
|
+
<Data name="PollDefaultData">
|
|
20
|
+
<Value name="1">
|
|
21
|
+
<Value>%%CLASSNAME</Value>
|
|
22
|
+
</Value>
|
|
23
|
+
</Data>
|
|
24
|
+
<DataLocation>^IOP.PrivateS9756.PollD</DataLocation>
|
|
25
|
+
<DefaultData>PollDefaultData</DefaultData>
|
|
26
|
+
<IdLocation>^IOP.PrivateS9756.PollD</IdLocation>
|
|
27
|
+
<IndexLocation>^IOP.PrivateS9756.PollI</IndexLocation>
|
|
28
|
+
<StreamLocation>^IOP.PrivateS9756.PollS</StreamLocation>
|
|
29
|
+
<Type>%Storage.Persistent</Type>
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* Copyright (c) 2022 by InterSystems Corporation.
|
|
2
|
+
Cambridge, Massachusetts, U.S.A. All rights reserved.
|
|
3
|
+
Confidential property of InterSystems Corporation. */
|
|
4
|
+
|
|
5
|
+
Class IOP.PrivateSession.Message.Start Extends (%Persistent, Ens.Util.MessageBodyMethods) [ ClassType = persistent, Inheritance = right, ProcedureBlock, System = 4 ]
|
|
6
|
+
{
|
|
7
|
+
|
|
8
|
+
Parameter DOMAIN = "PrivateSession";
|
|
9
|
+
|
|
10
|
+
/// From 'Ens.Util.MessageBodyMethods'
|
|
11
|
+
Method %ShowContents(pZenOutput As %Boolean = 0)
|
|
12
|
+
{
|
|
13
|
+
Write $$$Text("(session-start)")
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
Storage Default
|
|
17
|
+
{
|
|
18
|
+
<Data name="StartDefaultData">
|
|
19
|
+
<Value name="1">
|
|
20
|
+
<Value>%%CLASSNAME</Value>
|
|
21
|
+
</Value>
|
|
22
|
+
</Data>
|
|
23
|
+
<DataLocation>^IOP.PrivateSession.M6AEC.StartD</DataLocation>
|
|
24
|
+
<DefaultData>StartDefaultData</DefaultData>
|
|
25
|
+
<IdLocation>^IOP.PrivateSession.M6AEC.StartD</IdLocation>
|
|
26
|
+
<IndexLocation>^IOP.PrivateSession.M6AEC.StartI</IndexLocation>
|
|
27
|
+
<StreamLocation>^IOP.PrivateSession.M6AEC.StartS</StreamLocation>
|
|
28
|
+
<Type>%Storage.Persistent</Type>
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/* Copyright (c) 2022 by InterSystems Corporation.
|
|
2
|
+
Cambridge, Massachusetts, U.S.A. All rights reserved.
|
|
3
|
+
Confidential property of InterSystems Corporation. */
|
|
4
|
+
|
|
5
|
+
/// This class is a DICOM framework class
|
|
6
|
+
Class IOP.PrivateSession.Message.Stop Extends (%Persistent, Ens.Util.MessageBodyMethods) [ ClassType = persistent, Inheritance = right, ProcedureBlock, System = 4 ]
|
|
7
|
+
{
|
|
8
|
+
|
|
9
|
+
Parameter DOMAIN = "PrivateSession";
|
|
10
|
+
|
|
11
|
+
/// The message body
|
|
12
|
+
Property AttachedMessage As %Persistent(CLASSNAME = 1);
|
|
13
|
+
|
|
14
|
+
/// From 'Ens.Util.MessageBodyMethods'
|
|
15
|
+
Method %ShowContents(pZenOutput As %Boolean = 0)
|
|
16
|
+
{
|
|
17
|
+
If $IsObject(..AttachedMessage) {
|
|
18
|
+
Write $$$FormatText($$$Text("(session-stop) with AttachedMessage [%1] "),$classname(..AttachedMessage))
|
|
19
|
+
} Else {
|
|
20
|
+
Write $$$Text("(session-stop)")
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
Method %OnNew(initvalue As %RegisteredObject) As %Status [ Private, ProcedureBlock = 1, ServerOnly = 1 ]
|
|
25
|
+
{
|
|
26
|
+
Set ..AttachedMessage=initvalue
|
|
27
|
+
Quit $$$OK
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
Storage Default
|
|
31
|
+
{
|
|
32
|
+
<Data name="StopDefaultData">
|
|
33
|
+
<Value name="1">
|
|
34
|
+
<Value>%%CLASSNAME</Value>
|
|
35
|
+
</Value>
|
|
36
|
+
<Value name="2">
|
|
37
|
+
<Value>AttachedMessage</Value>
|
|
38
|
+
</Value>
|
|
39
|
+
</Data>
|
|
40
|
+
<DataLocation>^IOP.PrivateS9756.StopD</DataLocation>
|
|
41
|
+
<DefaultData>StopDefaultData</DefaultData>
|
|
42
|
+
<IdLocation>^IOP.PrivateS9756.StopD</IdLocation>
|
|
43
|
+
<IndexLocation>^IOP.PrivateS9756.StopI</IndexLocation>
|
|
44
|
+
<StreamLocation>^IOP.PrivateS9756.StopS</StreamLocation>
|
|
45
|
+
<Type>%Storage.Persistent</Type>
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Class IOP.Projection Extends %Projection.AbstractProjection
|
|
2
|
+
{
|
|
3
|
+
|
|
4
|
+
/// Projection to make install on compile
|
|
5
|
+
Projection Reference As Projection;
|
|
6
|
+
|
|
7
|
+
/// Call of the projection
|
|
8
|
+
ClassMethod CreateProjection(
|
|
9
|
+
cls As %String,
|
|
10
|
+
ByRef params) As %Status
|
|
11
|
+
{
|
|
12
|
+
set tSC = $$$OK
|
|
13
|
+
set tCurrentNamespace = $Namespace
|
|
14
|
+
|
|
15
|
+
Try {
|
|
16
|
+
set $NAMESPACE = "%SYS"
|
|
17
|
+
// Create a new Web App for IOP Remote Handler
|
|
18
|
+
set webName = "/api/iop"
|
|
19
|
+
set webProperties("NameSpace") = tCurrentNamespace
|
|
20
|
+
set webProperties("Enabled") = 1
|
|
21
|
+
set webProperties("DispatchClass") = "IOP.Service.Remote.Handler"
|
|
22
|
+
set webProperties("AutheEnabled") = 32
|
|
23
|
+
set webProperties("ServeFiles")=2
|
|
24
|
+
set webProperties("Recurse")=1
|
|
25
|
+
if ##class(Security.Applications).Exists(webName) {
|
|
26
|
+
// If the web application already exists, delete it first
|
|
27
|
+
$$$ThrowOnError(##class(Security.Applications).Delete(webName))
|
|
28
|
+
}
|
|
29
|
+
$$$ThrowOnError(##class(Security.Applications).Create(webName, .webProperties))
|
|
30
|
+
}
|
|
31
|
+
Catch ex {
|
|
32
|
+
|
|
33
|
+
Write !,"Error creating web application: ", ex.DisplayString(), !
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
znspace tCurrentNamespace
|
|
38
|
+
Return tSC
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
ClassMethod RemoveProjection(
|
|
42
|
+
cls As %String,
|
|
43
|
+
ByRef params,
|
|
44
|
+
recompile As %Boolean) As %Status
|
|
45
|
+
{
|
|
46
|
+
Quit $$$OK
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Class IOP.Service.Remote.Handler Extends %CSP.REST
|
|
2
|
+
{
|
|
3
|
+
|
|
4
|
+
Parameter CHARSET = "utf-8";
|
|
5
|
+
|
|
6
|
+
Parameter CONVERTINPUTSTREAM = 1;
|
|
7
|
+
|
|
8
|
+
Parameter CONTENTTYPE = "application/json";
|
|
9
|
+
|
|
10
|
+
/// This parameter influences the CORS support. The default is an empty string meaning 'not specified'.
|
|
11
|
+
/// If set to true (1) then CORS processing is ON. If set to false (0) then CORS processing is OFF.
|
|
12
|
+
/// If left unset "" then the decision to process CORS is delegated to the setting on the URL map route.
|
|
13
|
+
Parameter HandleCorsRequest = 1;
|
|
14
|
+
|
|
15
|
+
Parameter UseSession As Integer = 0;
|
|
16
|
+
|
|
17
|
+
/// Ignore any writes done directly by the REST method.
|
|
18
|
+
Parameter IgnoreWrites = 0;
|
|
19
|
+
|
|
20
|
+
XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap" ]
|
|
21
|
+
{
|
|
22
|
+
<Routes>
|
|
23
|
+
<!-- Iop Management -->
|
|
24
|
+
<Map Prefix="/v1" Forward="IOP.Service.Remote.Rest.v1"/>
|
|
25
|
+
<!-- make the default forward to the highest current version of the API -->
|
|
26
|
+
<Map Prefix="/*" Forward="IOP.Service.Remote.Rest.v1"/>
|
|
27
|
+
</Routes>
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
Class IOP.Service.Remote.Rest.v1 Extends %CSP.REST
|
|
2
|
+
{
|
|
3
|
+
|
|
4
|
+
XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap" ]
|
|
5
|
+
{
|
|
6
|
+
<Routes>
|
|
7
|
+
<Route Url="/migrate" Method="PUT" Call="PutMigrate"/>
|
|
8
|
+
<Route Url="/version" Method="GET" Call="GetVersion"/>
|
|
9
|
+
</Routes>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
ClassMethod GetVersion() As %String
|
|
13
|
+
{
|
|
14
|
+
// Return the version of the IOP service
|
|
15
|
+
Return {
|
|
16
|
+
"version": "1.0.0",
|
|
17
|
+
"description": "Interoperability Embedded Python Service API"
|
|
18
|
+
}.%ToJSON()
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
ClassMethod NamespaceCheck(pNamespace As %String) As %Boolean [ Internal, Private ]
|
|
22
|
+
{
|
|
23
|
+
If '##class(%SYS.Namespace).Exists(pNamespace) {
|
|
24
|
+
throw $$$ERROR("NamespaceDoesNotExist")
|
|
25
|
+
}
|
|
26
|
+
Return 1
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
ClassMethod PutMigrate() As %DynamicObject
|
|
30
|
+
{
|
|
31
|
+
Try {
|
|
32
|
+
// Get the request body
|
|
33
|
+
set dyna = {}.%FromJSON(%request.Content)
|
|
34
|
+
set body = dyna.%Get("body")
|
|
35
|
+
set namespace = dyna.%Get("namespace")
|
|
36
|
+
set targetDirectory = dyna.%Get("remote_folder")
|
|
37
|
+
set packageName = dyna.%Get("package")
|
|
38
|
+
// check for namespace existence and user permissions against namespace
|
|
39
|
+
If '..NamespaceCheck(namespace) {
|
|
40
|
+
Return ""
|
|
41
|
+
}
|
|
42
|
+
New $NAMESPACE
|
|
43
|
+
Set $NAMESPACE = namespace
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
//Create directory for custom packages
|
|
47
|
+
If targetDirectory '= "" {
|
|
48
|
+
If '##class(%Library.File).DirectoryExists(targetDirectory) {
|
|
49
|
+
If '##class(%Library.File).CreateDirectory(targetDirectory) {
|
|
50
|
+
$$$ThrowStatus($$$ERROR($$$DirectoryCannotCreate, targetDirectory))
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
Else {
|
|
55
|
+
// Set targetDirectory to the CODE DATABASE directory
|
|
56
|
+
do ##class(%SYS.Namespace).GetAllNSInfo(namespace,.info)
|
|
57
|
+
Set targetDirectory = info("RoutineDB","Directory")
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
Set packagePath = ##class(%Library.File).NormalizeDirectory(packageName, targetDirectory)
|
|
61
|
+
// If the package already exists then we must be meaning to re-load it. Delete files/directory/metadata and recreate fresh.
|
|
62
|
+
If ##class(%Library.File).DirectoryExists(packagePath) {
|
|
63
|
+
If '##class(%Library.File).RemoveDirectoryTree(packagePath) {
|
|
64
|
+
$$$ThrowStatus($$$ERROR($$$DirectoryPermission , packagePath))
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
If '##class(%Library.File).CreateDirectory(packagePath) {
|
|
68
|
+
$$$ThrowStatus($$$ERROR($$$DirectoryCannotCreate, packagePath))
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
//Unpack JSON objects
|
|
72
|
+
Set iterator = body.%GetIterator()
|
|
73
|
+
While iterator.%GetNext(.key , .fileObject ) {
|
|
74
|
+
// If fileObject.name has '/' then it is a path, we need to normalize it
|
|
75
|
+
Set fileName = ##class(%Library.File).NormalizeFilename(fileObject.name,packagePath)
|
|
76
|
+
do ##class(%Library.File).CreateDirectoryChain(##class(%Library.File).GetDirectory(fileName))
|
|
77
|
+
Set fileStream = ##class(%Stream.FileCharacter).%New()
|
|
78
|
+
Set fileStream.TranslateTable = "UTF8"
|
|
79
|
+
$$$ThrowOnError(fileStream.LinkToFile(fileName))
|
|
80
|
+
Do fileStream.Write(fileObject.data)
|
|
81
|
+
$$$ThrowOnError(fileStream.%Save())
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
//Do the iop migration
|
|
85
|
+
|
|
86
|
+
set iopUtils = ##class(IOP.Wrapper).Import("iop._utils")
|
|
87
|
+
do iopUtils."_Utils".migrate(##class(%Library.File).NormalizeFilename("settings.py", packagePath))
|
|
88
|
+
}
|
|
89
|
+
Catch ex {
|
|
90
|
+
$$$ThrowOnError(ex.AsStatus())
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
return $$$OK
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
}
|