iris-pex-embedded-python 3.7.2b2__py3-none-any.whl → 4.0.0__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.
- iop/__init__.py +276 -18
- iop/__main__.py +3 -3
- iop/cli/__init__.py +1 -0
- iop/cli/formatting.py +45 -0
- iop/{_cli.py → cli/main.py} +238 -216
- iop/cli/parser.py +165 -0
- iop/cli/types.py +73 -0
- iop/cls/IOP/Common.cls +11 -2
- iop/cls/IOP/PrivateSession/Duplex.cls +1 -1
- iop/cls/IOP/Service/Remote/Rest/v1.cls +152 -5
- iop/cls/IOP/Utils.cls +814 -7
- iop/cls/IOP/Wrapper.cls +1 -1
- iop/components/__init__.py +16 -0
- iop/{_async_request.py → components/async_request.py} +7 -7
- iop/components/business_host.py +363 -0
- iop/components/business_operation.py +84 -0
- iop/{_business_process.py → components/business_process.py} +145 -125
- iop/components/business_service.py +106 -0
- iop/{_common.py → components/common.py} +160 -164
- iop/{_debugpy.py → components/debugpy.py} +11 -11
- iop/{_generator_request.py → components/generator_request.py} +4 -4
- iop/{_inbound_adapter.py → components/inbound_adapter.py} +10 -18
- iop/{_log_manager.py → components/log_manager.py} +1 -1
- iop/{_outbound_adapter.py → components/outbound_adapter.py} +1 -1
- iop/components/polling_business_service.py +48 -0
- iop/{_private_session_duplex.py → components/private_session_duplex.py} +7 -9
- iop/{_private_session_process.py → components/private_session_process.py} +2 -2
- iop/{_settings.py → components/settings.py} +23 -3
- iop/messages/__init__.py +7 -0
- iop/messages/base.py +61 -0
- iop/{_decorators.py → messages/decorators.py} +8 -2
- iop/messages/dispatch.py +351 -0
- iop/{_persistent_message.py → messages/persistent.py} +24 -19
- iop/{_serialization.py → messages/serialization.py} +34 -21
- iop/{_message_validator.py → messages/validation.py} +15 -13
- iop/migration/__init__.py +1 -0
- iop/migration/io.py +61 -0
- iop/migration/manifest.py +534 -0
- iop/migration/plans.py +80 -0
- iop/migration/utils.py +1126 -0
- iop/production/__init__.py +55 -0
- iop/production/actions.py +525 -0
- iop/production/common.py +103 -0
- iop/production/component.py +234 -0
- iop/production/declarations.py +190 -0
- iop/production/declarative.py +214 -0
- iop/production/diff.py +327 -0
- iop/production/import_.py +296 -0
- iop/production/inspection.py +92 -0
- iop/production/model.py +1143 -0
- iop/production/planning.py +678 -0
- iop/production/reconstruction.py +341 -0
- iop/production/rendering.py +610 -0
- iop/production/runtime.py +91 -0
- iop/production/source_inference.py +729 -0
- iop/production/types.py +546 -0
- iop/production/validation.py +452 -0
- iop/runtime/__init__.py +1 -0
- iop/runtime/director.py +415 -0
- iop/runtime/environment.py +59 -0
- iop/{_iris.py → runtime/iris.py} +2 -2
- iop/runtime/local.py +145 -0
- iop/{_director_protocol.py → runtime/protocol.py} +25 -8
- iop/runtime/remote/__init__.py +12 -0
- iop/runtime/remote/client.py +90 -0
- iop/runtime/remote/director.py +283 -0
- iop/runtime/remote/migration.py +57 -0
- iop/runtime/remote/settings.py +69 -0
- iop/runtime/remote/setup.py +72 -0
- {iris_pex_embedded_python-3.7.2b2.dist-info → iris_pex_embedded_python-4.0.0.dist-info}/METADATA +11 -2
- iris_pex_embedded_python-4.0.0.dist-info/RECORD +99 -0
- iris_pex_embedded_python-4.0.0.dist-info/entry_points.txt +2 -0
- iris_pex_embedded_python-4.0.0.dist-info/top_level.txt +1 -0
- grongier/__init__.py +0 -0
- grongier/cls/Grongier/PEX/BusinessOperation.cls +0 -8
- grongier/cls/Grongier/PEX/BusinessProcess.cls +0 -13
- grongier/cls/Grongier/PEX/BusinessService.cls +0 -8
- grongier/cls/Grongier/PEX/Common.cls +0 -10
- grongier/cls/Grongier/PEX/Director.cls +0 -10
- grongier/cls/Grongier/PEX/Duplex/Operation.cls +0 -4
- grongier/cls/Grongier/PEX/Duplex/Process.cls +0 -13
- grongier/cls/Grongier/PEX/Duplex/Service.cls +0 -4
- grongier/cls/Grongier/PEX/InboundAdapter.cls +0 -8
- grongier/cls/Grongier/PEX/Message.cls +0 -13
- grongier/cls/Grongier/PEX/OutboundAdapter.cls +0 -8
- grongier/cls/Grongier/PEX/PickleMessage.cls +0 -13
- grongier/cls/Grongier/PEX/PrivateSession/Duplex.cls +0 -8
- grongier/cls/Grongier/PEX/PrivateSession/Message/Ack.cls +0 -14
- grongier/cls/Grongier/PEX/PrivateSession/Message/Poll.cls +0 -14
- grongier/cls/Grongier/PEX/PrivateSession/Message/Start.cls +0 -14
- grongier/cls/Grongier/PEX/PrivateSession/Message/Stop.cls +0 -14
- grongier/cls/Grongier/PEX/Test.cls +0 -10
- grongier/cls/Grongier/PEX/Utils.cls +0 -10
- grongier/cls/Grongier/Service/WSGI.cls +0 -4
- grongier/pex/__init__.py +0 -75
- grongier/pex/__main__.py +0 -4
- grongier/pex/_business_host.py +0 -1
- grongier/pex/_cli.py +0 -4
- grongier/pex/_common.py +0 -1
- grongier/pex/_director.py +0 -1
- grongier/pex/_utils.py +0 -1
- grongier/pex/wsgi/handlers.py +0 -104
- iop/_business_host.py +0 -322
- iop/_business_operation.py +0 -77
- iop/_business_service.py +0 -67
- iop/_director.py +0 -333
- iop/_dispatch.py +0 -194
- iop/_local.py +0 -106
- iop/_message.py +0 -45
- iop/_polling_business_service.py +0 -6
- iop/_remote.py +0 -473
- iop/_utils.py +0 -912
- iop/cls/IOP/Service/WSGI.cls +0 -310
- iop/wsgi/handlers.py +0 -112
- iris_pex_embedded_python-3.7.2b2.dist-info/RECORD +0 -96
- iris_pex_embedded_python-3.7.2b2.dist-info/entry_points.txt +0 -2
- iris_pex_embedded_python-3.7.2b2.dist-info/top_level.txt +0 -2
- {iris_pex_embedded_python-3.7.2b2.dist-info → iris_pex_embedded_python-4.0.0.dist-info}/WHEEL +0 -0
- {iris_pex_embedded_python-3.7.2b2.dist-info → iris_pex_embedded_python-4.0.0.dist-info}/licenses/LICENSE +0 -0
iop/cls/IOP/Utils.cls
CHANGED
|
@@ -72,6 +72,7 @@ ClassMethod DeleteComponentProxy(pClassname As %String = "") As %Status
|
|
|
72
72
|
#dim ex As %Exception.AbstractException
|
|
73
73
|
#dim tIsIOP As %Boolean = 0
|
|
74
74
|
#dim tClass As %Dictionary.CompiledClass
|
|
75
|
+
#dim tReferences As %DynamicArray
|
|
75
76
|
|
|
76
77
|
Quit:(""=pClassname) $$$ERROR($$$EnsErrGeneral,"Remote class name must be specified.")
|
|
77
78
|
|
|
@@ -90,16 +91,20 @@ ClassMethod DeleteComponentProxy(pClassname As %String = "") As %Status
|
|
|
90
91
|
}
|
|
91
92
|
Set tIsIOP = ("IOP.Utils" = tClass.GeneratedBy)
|
|
92
93
|
}
|
|
93
|
-
If tIsIOP {
|
|
94
|
-
Set tSC = ##class(%Dictionary.ClassDefinition).%DeleteId(pClassname)
|
|
95
|
-
If $$$ISERR(tSC) {
|
|
96
|
-
Set tSC = $$$ERROR($$$EnsErrGeneral,$$$FormatText("Unable to delete proxy class for remote class '%1' : '%2'.",pClassname,$System.Status.GetErrorText(tSC)))
|
|
97
|
-
Quit
|
|
98
|
-
}
|
|
99
|
-
} Else {
|
|
94
|
+
If 'tIsIOP {
|
|
100
95
|
Set tSC = $$$ERROR($$$EnsErrGeneral,$$$FormatText("Cannot delete class '%1' because it is not a IOP proxy class.",pClassname))
|
|
101
96
|
Quit
|
|
102
97
|
}
|
|
98
|
+
$$$ThrowOnError(..FindComponentProxyReferences(pClassname,.tReferences))
|
|
99
|
+
If tReferences.%Size() > 0 {
|
|
100
|
+
Set tSC = $$$ERROR($$$EnsErrGeneral,$$$FormatText("Cannot delete class '%1' because it is used by production items: %2.",pClassname,..FormatComponentProxyReferences(tReferences)))
|
|
101
|
+
Quit
|
|
102
|
+
}
|
|
103
|
+
Set tSC = ##class(%Dictionary.ClassDefinition).%DeleteId(pClassname)
|
|
104
|
+
If $$$ISERR(tSC) {
|
|
105
|
+
Set tSC = $$$ERROR($$$EnsErrGeneral,$$$FormatText("Unable to delete proxy class for remote class '%1' : '%2'.",pClassname,$System.Status.GetErrorText(tSC)))
|
|
106
|
+
Quit
|
|
107
|
+
}
|
|
103
108
|
|
|
104
109
|
} Catch ex {
|
|
105
110
|
Set tSC = ex.AsStatus()
|
|
@@ -108,6 +113,132 @@ ClassMethod DeleteComponentProxy(pClassname As %String = "") As %Status
|
|
|
108
113
|
Quit tSC
|
|
109
114
|
}
|
|
110
115
|
|
|
116
|
+
ClassMethod FindComponentProxyReferences(
|
|
117
|
+
pClassname As %String,
|
|
118
|
+
ByRef pReferences) As %Status [ Internal ]
|
|
119
|
+
{
|
|
120
|
+
#dim tSC As %Status = $$$OK
|
|
121
|
+
#dim ex As %Exception.AbstractException
|
|
122
|
+
Set pReferences = []
|
|
123
|
+
Quit:(""=pClassname) $$$ERROR($$$EnsErrGeneral,"Remote class name must be specified.")
|
|
124
|
+
Try {
|
|
125
|
+
Set tRS = ##class(%ResultSet).%New("Ens.Config.Production:ProductionStatus")
|
|
126
|
+
$$$ThrowOnError(tRS.Execute())
|
|
127
|
+
While tRS.Next() {
|
|
128
|
+
$$$ThrowOnError(..CollectProductionProxyReferences(tRS.Data("Production"),pClassname,.pReferences))
|
|
129
|
+
}
|
|
130
|
+
} Catch ex {
|
|
131
|
+
Set tSC = ex.AsStatus()
|
|
132
|
+
}
|
|
133
|
+
Quit tSC
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
ClassMethod CollectProductionProxyReferences(
|
|
137
|
+
pProductionName As %String,
|
|
138
|
+
pClassname As %String,
|
|
139
|
+
ByRef pReferences) As %Status [ Internal, Private ]
|
|
140
|
+
{
|
|
141
|
+
#dim tProduction As Ens.Config.Production
|
|
142
|
+
#dim tItem As Ens.Config.Item
|
|
143
|
+
Set tProduction = ##class(Ens.Config.Production).%OpenId(pProductionName)
|
|
144
|
+
If '$IsObject(tProduction) {
|
|
145
|
+
Set tLoaded = ##class(Ens.Config.Production).LoadFromClass(pProductionName)
|
|
146
|
+
If $IsObject(tLoaded) {
|
|
147
|
+
Set tProduction = tLoaded
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
If '$IsObject(tProduction) {
|
|
151
|
+
Quit $$$OK
|
|
152
|
+
}
|
|
153
|
+
For i=1:1:tProduction.Items.Count() {
|
|
154
|
+
Set tItem = tProduction.Items.GetAt(i)
|
|
155
|
+
If '$IsObject(tItem) Continue
|
|
156
|
+
If tItem.ClassName = pClassname {
|
|
157
|
+
Set tReference = {}
|
|
158
|
+
Set tReference.production = pProductionName
|
|
159
|
+
Set tReference.item = tItem.Name
|
|
160
|
+
Do pReferences.%Push(tReference)
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
Quit $$$OK
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
ClassMethod FormatComponentProxyReferences(pReferences As %DynamicArray) As %String [ Internal, Private ]
|
|
167
|
+
{
|
|
168
|
+
Set tValue = ""
|
|
169
|
+
For i=0:1:pReferences.%Size()-1 {
|
|
170
|
+
Set tReference = pReferences.%Get(i)
|
|
171
|
+
Set tValue = tValue_$Select(tValue="":"",1:", ")_tReference.production_"/"_tReference.item
|
|
172
|
+
}
|
|
173
|
+
Quit tValue
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
ClassMethod ListComponentProxies(pUnusedOnly As %Boolean = 0) As %String
|
|
177
|
+
{
|
|
178
|
+
#dim ex As %Exception.AbstractException
|
|
179
|
+
Set tResult = []
|
|
180
|
+
Try {
|
|
181
|
+
Set tStmt = ##class(%SQL.Statement).%New()
|
|
182
|
+
$$$ThrowOnError(tStmt.%Prepare("SELECT Name FROM %Dictionary.ClassDefinition WHERE GeneratedBy = ? ORDER BY Name"))
|
|
183
|
+
Set tRS = tStmt.%Execute("IOP.Utils")
|
|
184
|
+
While tRS.%Next() {
|
|
185
|
+
Set tClassname = tRS.%Get("Name")
|
|
186
|
+
If '$classmethod(tClassname,"%Extends","IOP.Common") {
|
|
187
|
+
Continue
|
|
188
|
+
}
|
|
189
|
+
$$$ThrowOnError(..FindComponentProxyReferences(tClassname,.tReferences))
|
|
190
|
+
If pUnusedOnly {
|
|
191
|
+
If tReferences.%Size() > 0 {
|
|
192
|
+
Continue
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
Set tEntry = {}
|
|
196
|
+
Set tEntry."class" = tClassname
|
|
197
|
+
Set tEntry.super = ..ProxySuperClass(tClassname)
|
|
198
|
+
Set tEntry.module = ..ProxyPropertyInitialValue(tClassname,"%module")
|
|
199
|
+
Set tEntry.classname = ..ProxyPropertyInitialValue(tClassname,"%classname")
|
|
200
|
+
Set tEntry.classpaths = ..ProxyPropertyInitialValue(tClassname,"%classpaths")
|
|
201
|
+
Set tEntry.used = (tReferences.%Size() > 0)
|
|
202
|
+
Set tEntry."used_by" = tReferences
|
|
203
|
+
Do tResult.%Push(tEntry)
|
|
204
|
+
}
|
|
205
|
+
} Catch ex {
|
|
206
|
+
$$$ThrowOnError(ex.AsStatus())
|
|
207
|
+
}
|
|
208
|
+
Quit tResult.%ToJSON()
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
ClassMethod ProxySuperClass(pClassname As %String) As %String [ Internal, Private ]
|
|
212
|
+
{
|
|
213
|
+
Set tClass = ##class(%Dictionary.ClassDefinition).%OpenId(pClassname)
|
|
214
|
+
If '$IsObject(tClass) {
|
|
215
|
+
Quit ""
|
|
216
|
+
}
|
|
217
|
+
Quit tClass.Super
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
ClassMethod ProxyPropertyInitialValue(
|
|
221
|
+
pClassname As %String,
|
|
222
|
+
pProperty As %String) As %String [ Internal, Private ]
|
|
223
|
+
{
|
|
224
|
+
Set tStmt = ##class(%SQL.Statement).%New()
|
|
225
|
+
$$$ThrowOnError(tStmt.%Prepare("SELECT InitialExpression FROM %Dictionary.PropertyDefinition WHERE parent = ? AND name = ?"))
|
|
226
|
+
Set tRS = tStmt.%Execute(pClassname,pProperty)
|
|
227
|
+
If tRS.%Next() {
|
|
228
|
+
Quit ..UnquoteInitialExpression(tRS.%Get("InitialExpression"))
|
|
229
|
+
}
|
|
230
|
+
Quit ""
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
ClassMethod UnquoteInitialExpression(pValue As %String) As %String [ Internal, Private ]
|
|
234
|
+
{
|
|
235
|
+
Set tValue = $Get(pValue)
|
|
236
|
+
If ($Extract(tValue,1)="""")&&($Extract(tValue,*)="""") {
|
|
237
|
+
Set tValue = $Extract(tValue,2,*-1)
|
|
238
|
+
}
|
|
239
|
+
Quit tValue
|
|
240
|
+
}
|
|
241
|
+
|
|
111
242
|
// ..GetRemoteClassInfo(pRemoteClassname,pModule,pCLASSPATHS,.tClassDetails,.tRemoteSettings)
|
|
112
243
|
|
|
113
244
|
ClassMethod GetRemoteClassInfo(
|
|
@@ -150,7 +281,14 @@ ClassMethod GetRemoteClassInfo(
|
|
|
150
281
|
|
|
151
282
|
// Get the class
|
|
152
283
|
set class = builtins.getattr(module, pRemoteClassname)
|
|
284
|
+
// Allocate without calling Python __init__. Registration only reads
|
|
285
|
+
// metadata; runtime startup belongs in on_init().
|
|
153
286
|
set tClass = class."__new__"(class)
|
|
287
|
+
Try {
|
|
288
|
+
Do tClass."_warn_if_custom_init"()
|
|
289
|
+
}
|
|
290
|
+
Catch ex {
|
|
291
|
+
}
|
|
154
292
|
|
|
155
293
|
If $IsObject(tClass) {
|
|
156
294
|
#; List of information about the class as a whole - $lb(SuperClass, Description, InfoURL, IconURL, Adapter)
|
|
@@ -455,6 +593,159 @@ ClassMethod CreateProduction(
|
|
|
455
593
|
return $System.OBJ.Compile(produtionClassName,"k-d")
|
|
456
594
|
}
|
|
457
595
|
|
|
596
|
+
ClassMethod CreateProductionFromJSON(
|
|
597
|
+
pProductionName As %String,
|
|
598
|
+
pDefinition As %String) As %Status
|
|
599
|
+
{
|
|
600
|
+
#dim tSC As %Status = $$$OK
|
|
601
|
+
#dim ex As %Exception.AbstractException
|
|
602
|
+
#dim tPayload As %DynamicObject
|
|
603
|
+
#dim tProductionData As %DynamicObject
|
|
604
|
+
#dim tProduction As Ens.Config.Production
|
|
605
|
+
#dim tProductionClass As %Dictionary.ClassDefinition
|
|
606
|
+
#dim tItems,tDeclaredName
|
|
607
|
+
Try {
|
|
608
|
+
Return:(""=pProductionName) $$$ERROR($$$EnsErrGeneral,"Production name is required.")
|
|
609
|
+
Return:('$ZName(pProductionName,4)) $$$ERROR($$$EnsErrGeneral,"Invalid Production name.")
|
|
610
|
+
|
|
611
|
+
Set tPayload = {}.%FromJSON(pDefinition)
|
|
612
|
+
Set tProductionData = tPayload.%Get("Production")
|
|
613
|
+
If '$IsObject(tProductionData) {
|
|
614
|
+
Set tSC = $$$ERROR($$$EnsErrGeneral,"Production JSON must contain a Production object.")
|
|
615
|
+
Quit
|
|
616
|
+
}
|
|
617
|
+
Set tDeclaredName = ..DynamicGet(tProductionData,"@Name","")
|
|
618
|
+
If ""'=tDeclaredName {
|
|
619
|
+
If pProductionName'=tDeclaredName {
|
|
620
|
+
Set tSC = $$$ERROR($$$EnsErrGeneral,"Production JSON name does not match target production name.")
|
|
621
|
+
Quit
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
If ('##class(%Dictionary.ClassDefinition).%ExistsId(pProductionName)) {
|
|
626
|
+
Set tProductionClass = ##class(%Dictionary.ClassDefinition).%New()
|
|
627
|
+
Set tProductionClass.Name = pProductionName
|
|
628
|
+
Set tProductionClass.Super = "Ens.Production"
|
|
629
|
+
Set tProductionClass.ClassVersion = 25
|
|
630
|
+
Set tSC = tProductionClass.%Save()
|
|
631
|
+
Quit:$$$ISERR(tSC)
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
Set tProduction = ##class(Ens.Config.Production).%New()
|
|
635
|
+
Set tProduction.Name = pProductionName
|
|
636
|
+
Set tProduction.Description = ..DynamicGet(tProductionData,"Description","")
|
|
637
|
+
Set tProduction.ActorPoolSize = +..DynamicGet(tProductionData,"ActorPoolSize",2)
|
|
638
|
+
Set tProduction.TestingEnabled = ..BooleanValue(..DynamicGet(tProductionData,"@TestingEnabled",0))
|
|
639
|
+
Set tProduction.LogGeneralTraceEvents = ..BooleanValue(..DynamicGet(tProductionData,"@LogGeneralTraceEvents",0))
|
|
640
|
+
|
|
641
|
+
$$$ThrowOnError(..InsertSettings(tProduction,tProductionData.%Get("Setting")))
|
|
642
|
+
Set tItems = tProductionData.%Get("Item")
|
|
643
|
+
$$$ThrowOnError(..InsertItems(tProduction,tItems))
|
|
644
|
+
|
|
645
|
+
Set tSC = tProduction.SaveToClass()
|
|
646
|
+
Quit:$$$ISERR(tSC)
|
|
647
|
+
Set tSC = $System.OBJ.Compile(pProductionName,"k-d")
|
|
648
|
+
} Catch ex {
|
|
649
|
+
Set tSC = ex.AsStatus()
|
|
650
|
+
}
|
|
651
|
+
Quit tSC
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
ClassMethod DynamicGet(pObject, pName As %String, pDefault = "") [ Internal, Private ]
|
|
655
|
+
{
|
|
656
|
+
#dim value
|
|
657
|
+
Try {
|
|
658
|
+
Set value = pObject.%Get(pName)
|
|
659
|
+
} Catch ex {
|
|
660
|
+
Return pDefault
|
|
661
|
+
}
|
|
662
|
+
Quit $Select(value="":pDefault,1:value)
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
ClassMethod BooleanValue(pValue) As %Boolean [ Internal, Private ]
|
|
666
|
+
{
|
|
667
|
+
Set tValue = $ZCONVERT(pValue,"L")
|
|
668
|
+
Quit $Select(tValue="true":1,tValue="1":1,tValue="yes":1,tValue="on":1,tValue="false":0,tValue="0":0,tValue="no":0,tValue="off":0,1:+pValue)
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
ClassMethod IsDynamicArray(pValue) As %Boolean [ Internal, Private ]
|
|
672
|
+
{
|
|
673
|
+
Quit $Select('$IsObject(pValue):0,pValue.%ClassName(1)="%Library.DynamicArray":1,1:0)
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
ClassMethod InsertItems(
|
|
677
|
+
pProduction As Ens.Config.Production,
|
|
678
|
+
pItems) As %Status [ Internal, Private ]
|
|
679
|
+
{
|
|
680
|
+
#dim tSC As %Status = $$$OK
|
|
681
|
+
If '$IsObject(pItems) {
|
|
682
|
+
Quit tSC
|
|
683
|
+
}
|
|
684
|
+
If ..IsDynamicArray(pItems) {
|
|
685
|
+
For i=0:1:pItems.%Size()-1 {
|
|
686
|
+
$$$ThrowOnError(..InsertItem(pProduction,pItems.%Get(i)))
|
|
687
|
+
}
|
|
688
|
+
} Else {
|
|
689
|
+
$$$ThrowOnError(..InsertItem(pProduction,pItems))
|
|
690
|
+
}
|
|
691
|
+
Quit tSC
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
ClassMethod InsertItem(
|
|
695
|
+
pProduction As Ens.Config.Production,
|
|
696
|
+
pItemData) As %Status [ Internal, Private ]
|
|
697
|
+
{
|
|
698
|
+
#dim tItem As Ens.Config.Item
|
|
699
|
+
Set tItem = ##class(Ens.Config.Item).%New()
|
|
700
|
+
Set tItem.Name = ..DynamicGet(pItemData,"@Name","")
|
|
701
|
+
Set tItem.ClassName = ..DynamicGet(pItemData,"@ClassName","")
|
|
702
|
+
Set tItem.Category = ..DynamicGet(pItemData,"@Category","")
|
|
703
|
+
Set tItem.PoolSize = +..DynamicGet(pItemData,"@PoolSize",0)
|
|
704
|
+
Set tItem.Enabled = ..BooleanValue(..DynamicGet(pItemData,"@Enabled",1))
|
|
705
|
+
Set tItem.Foreground = ..BooleanValue(..DynamicGet(pItemData,"@Foreground",0))
|
|
706
|
+
Set tItem.Comment = ..DynamicGet(pItemData,"@Comment","")
|
|
707
|
+
Set tItem.LogTraceEvents = ..BooleanValue(..DynamicGet(pItemData,"@LogTraceEvents",0))
|
|
708
|
+
Set tItem.Schedule = ..DynamicGet(pItemData,"@Schedule","")
|
|
709
|
+
Set tItem.Production = pProduction
|
|
710
|
+
|
|
711
|
+
$$$ThrowOnError(..InsertSettings(tItem,pItemData.%Get("Setting")))
|
|
712
|
+
Do pProduction.Items.Insert(tItem)
|
|
713
|
+
Quit $$$OK
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
ClassMethod InsertSettings(
|
|
717
|
+
pOwner,
|
|
718
|
+
pSettings) As %Status [ Internal, Private ]
|
|
719
|
+
{
|
|
720
|
+
#dim tSC As %Status = $$$OK
|
|
721
|
+
If '$IsObject(pSettings) {
|
|
722
|
+
Quit tSC
|
|
723
|
+
}
|
|
724
|
+
If ..IsDynamicArray(pSettings) {
|
|
725
|
+
For i=0:1:pSettings.%Size()-1 {
|
|
726
|
+
$$$ThrowOnError(..InsertSetting(pOwner,pSettings.%Get(i)))
|
|
727
|
+
}
|
|
728
|
+
} Else {
|
|
729
|
+
$$$ThrowOnError(..InsertSetting(pOwner,pSettings))
|
|
730
|
+
}
|
|
731
|
+
Quit tSC
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
ClassMethod InsertSetting(
|
|
735
|
+
pOwner,
|
|
736
|
+
pSettingData) As %Status [ Internal, Private ]
|
|
737
|
+
{
|
|
738
|
+
#dim tSetting As Ens.Config.Setting
|
|
739
|
+
#dim tDefaultTarget As %String
|
|
740
|
+
Set tDefaultTarget = $Select(pOwner.%IsA("Ens.Config.Production"):"",1:"Host")
|
|
741
|
+
Set tSetting = ##class(Ens.Config.Setting).%New()
|
|
742
|
+
Set tSetting.Target = ..DynamicGet(pSettingData,"@Target",tDefaultTarget)
|
|
743
|
+
Set tSetting.Name = ..DynamicGet(pSettingData,"@Name","")
|
|
744
|
+
Set tSetting.Value = ..DynamicGet(pSettingData,"#text","")
|
|
745
|
+
Do pOwner.Settings.Insert(tSetting)
|
|
746
|
+
Quit $$$OK
|
|
747
|
+
}
|
|
748
|
+
|
|
458
749
|
/// Export a production to an XML string
|
|
459
750
|
ClassMethod ExportProduction(pProductionName As %String) As %String
|
|
460
751
|
{
|
|
@@ -474,6 +765,522 @@ ClassMethod ExportProduction(pProductionName As %String) As %String
|
|
|
474
765
|
Return xdata
|
|
475
766
|
}
|
|
476
767
|
|
|
768
|
+
/// Export runtime production connections discovered through OnGetConnections.
|
|
769
|
+
ClassMethod ExportProductionConnections(pProductionName As %String) As %String
|
|
770
|
+
{
|
|
771
|
+
Set result = {}
|
|
772
|
+
Set result.production = pProductionName
|
|
773
|
+
Set result.items = []
|
|
774
|
+
Set result.warnings = []
|
|
775
|
+
Try {
|
|
776
|
+
Set production = ##class(Ens.Config.Production).%OpenId(pProductionName)
|
|
777
|
+
If '$IsObject(production) {
|
|
778
|
+
Set loaded = ##class(Ens.Config.Production).LoadFromClass(pProductionName)
|
|
779
|
+
If $IsObject(loaded) {
|
|
780
|
+
Set production = loaded
|
|
781
|
+
} Else {
|
|
782
|
+
Set warning = "Production could not be loaded: "_pProductionName
|
|
783
|
+
If loaded'="" {
|
|
784
|
+
Try {
|
|
785
|
+
If $System.Status.IsError(loaded) {
|
|
786
|
+
Set warning = warning_": "_$System.Status.GetOneStatusText(loaded)
|
|
787
|
+
}
|
|
788
|
+
} Catch exStatus {
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
Do result.warnings.%Push(warning)
|
|
792
|
+
Return result.%ToJSON()
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
For i=1:1:production.Items.Count() {
|
|
796
|
+
Set item = production.Items.GetAt(i)
|
|
797
|
+
If '$IsObject(item) Continue
|
|
798
|
+
Set itemResult = {}
|
|
799
|
+
Set itemResult.item = item.Name
|
|
800
|
+
Set itemResult."class_name" = item.ClassName
|
|
801
|
+
Set itemResult.kind = ..ProductionItemKind(item.ClassName)
|
|
802
|
+
Set adapterClass = ""
|
|
803
|
+
Try {
|
|
804
|
+
Set adapterClass = $Parameter(item.ClassName, "ADAPTER")
|
|
805
|
+
} Catch exAdapter {
|
|
806
|
+
}
|
|
807
|
+
If adapterClass '= "" {
|
|
808
|
+
Set itemResult."adapter_class_name" = adapterClass
|
|
809
|
+
}
|
|
810
|
+
If ..ProductionItemIsIOP(item.ClassName) {
|
|
811
|
+
Set itemResult.iop = 1
|
|
812
|
+
Set module = ..ProductionItemSettingOrProxyDefault(item,item.ClassName,"%module")
|
|
813
|
+
Set classname = ..ProductionItemSettingOrProxyDefault(item,item.ClassName,"%classname")
|
|
814
|
+
Set classpaths = ..ProductionItemSettingOrProxyDefault(item,item.ClassName,"%classpaths")
|
|
815
|
+
If module '= "" {
|
|
816
|
+
Set itemResult.module = module
|
|
817
|
+
}
|
|
818
|
+
If classname '= "" {
|
|
819
|
+
Set itemResult.classname = classname
|
|
820
|
+
}
|
|
821
|
+
If classpaths '= "" {
|
|
822
|
+
Set itemResult.classpaths = classpaths
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
Set itemResult.connections = []
|
|
826
|
+
Set itemResult.warnings = []
|
|
827
|
+
Try {
|
|
828
|
+
Kill connections
|
|
829
|
+
Do ##class(Ens.Config.Production).GetConnections(.connections,item.ClassName,item)
|
|
830
|
+
Set target = ""
|
|
831
|
+
For {
|
|
832
|
+
Set target = $Order(connections(target))
|
|
833
|
+
Quit:target=""
|
|
834
|
+
Do itemResult.connections.%Push(target)
|
|
835
|
+
}
|
|
836
|
+
} Catch ex {
|
|
837
|
+
Do itemResult.warnings.%Push(ex.DisplayString())
|
|
838
|
+
}
|
|
839
|
+
Do result.items.%Push(itemResult)
|
|
840
|
+
}
|
|
841
|
+
} Catch ex {
|
|
842
|
+
Do result.warnings.%Push(ex.DisplayString())
|
|
843
|
+
}
|
|
844
|
+
Return result.%ToJSON()
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
ClassMethod ProductionItemKind(pClassName As %String) As %String [ Internal, Private ]
|
|
848
|
+
{
|
|
849
|
+
Try {
|
|
850
|
+
If $ClassMethod(pClassName,"%Extends","Ens.BusinessService") {
|
|
851
|
+
Return "service"
|
|
852
|
+
}
|
|
853
|
+
If $ClassMethod(pClassName,"%Extends","Ens.BusinessProcess") {
|
|
854
|
+
Return "process"
|
|
855
|
+
}
|
|
856
|
+
If $ClassMethod(pClassName,"%Extends","Ens.BusinessOperation") {
|
|
857
|
+
Return "operation"
|
|
858
|
+
}
|
|
859
|
+
} Catch ex {
|
|
860
|
+
}
|
|
861
|
+
Quit "component"
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
ClassMethod ProductionItemIsIOP(pClassName As %String) As %Boolean [ Internal, Private ]
|
|
865
|
+
{
|
|
866
|
+
Try {
|
|
867
|
+
If $ClassMethod(pClassName,"%Extends","IOP.Common") {
|
|
868
|
+
Return 1
|
|
869
|
+
}
|
|
870
|
+
} Catch ex {
|
|
871
|
+
}
|
|
872
|
+
Try {
|
|
873
|
+
Set class = ##class(%Dictionary.ClassDefinition).%OpenId(pClassName)
|
|
874
|
+
If $IsObject(class) {
|
|
875
|
+
If class.GeneratedBy = $CLASSNAME() {
|
|
876
|
+
Return 1
|
|
877
|
+
}
|
|
878
|
+
If class.Super [ "IOP." {
|
|
879
|
+
Return 1
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
} Catch exClass {
|
|
883
|
+
}
|
|
884
|
+
Quit 0
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
ClassMethod ProductionItemSettingOrProxyDefault(
|
|
888
|
+
pItem As Ens.Config.Item,
|
|
889
|
+
pClassName As %String,
|
|
890
|
+
pSettingName As %String) As %String [ Internal, Private ]
|
|
891
|
+
{
|
|
892
|
+
Set value = ""
|
|
893
|
+
Try {
|
|
894
|
+
Do pItem.GetModifiedSetting(pSettingName,.value)
|
|
895
|
+
} Catch exSetting {
|
|
896
|
+
}
|
|
897
|
+
If value '= "" {
|
|
898
|
+
Quit value
|
|
899
|
+
}
|
|
900
|
+
Try {
|
|
901
|
+
Set value = ..ProxyPropertyInitialValue(pClassName,pSettingName)
|
|
902
|
+
} Catch exProxy {
|
|
903
|
+
}
|
|
904
|
+
Quit value
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
/// Export queue counters for production items.
|
|
908
|
+
ClassMethod ExportProductionQueueInfo(pProductionName As %String) As %String
|
|
909
|
+
{
|
|
910
|
+
Set result = {}
|
|
911
|
+
Set result.production = pProductionName
|
|
912
|
+
Set result.items = []
|
|
913
|
+
Set result.warnings = []
|
|
914
|
+
Try {
|
|
915
|
+
Set production = ##class(Ens.Config.Production).%OpenId(pProductionName)
|
|
916
|
+
If '$IsObject(production) {
|
|
917
|
+
Set loaded = ##class(Ens.Config.Production).LoadFromClass(pProductionName)
|
|
918
|
+
If $IsObject(loaded) {
|
|
919
|
+
Set production = loaded
|
|
920
|
+
} Else {
|
|
921
|
+
Set warning = "Production could not be loaded: "_pProductionName
|
|
922
|
+
If loaded'="" {
|
|
923
|
+
Try {
|
|
924
|
+
If $System.Status.IsError(loaded) {
|
|
925
|
+
Set warning = warning_": "_$System.Status.GetOneStatusText(loaded)
|
|
926
|
+
}
|
|
927
|
+
} Catch exStatus {
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
Do result.warnings.%Push(warning)
|
|
931
|
+
Return result.%ToJSON()
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
For i=1:1:production.Items.Count() {
|
|
935
|
+
Set item = production.Items.GetAt(i)
|
|
936
|
+
If '$IsObject(item) Continue
|
|
937
|
+
Set itemResult = {}
|
|
938
|
+
Set itemResult.item = item.Name
|
|
939
|
+
Set itemResult."queue_name" = item.Name
|
|
940
|
+
Set itemResult."class_name" = item.ClassName
|
|
941
|
+
Set queueCount = ##class(Ens.Queue).GetCount(item.Name)
|
|
942
|
+
If queueCount="" {
|
|
943
|
+
Set itemResult.exists = 0
|
|
944
|
+
Set itemResult.count = 0
|
|
945
|
+
} Else {
|
|
946
|
+
Set itemResult.exists = 1
|
|
947
|
+
Set itemResult.count = +queueCount
|
|
948
|
+
}
|
|
949
|
+
Do result.items.%Push(itemResult)
|
|
950
|
+
}
|
|
951
|
+
} Catch ex {
|
|
952
|
+
Do result.warnings.%Push(ex.DisplayString())
|
|
953
|
+
}
|
|
954
|
+
Return result.%ToJSON()
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
/// Apply a conservative granular production change plan.
|
|
958
|
+
ClassMethod ApplyProductionPlan(
|
|
959
|
+
pProductionName As %String,
|
|
960
|
+
pPlan As %String,
|
|
961
|
+
pAllowDestructive As %Boolean = 0) As %String
|
|
962
|
+
{
|
|
963
|
+
Set result = {}
|
|
964
|
+
Set result.production = pProductionName
|
|
965
|
+
Set result.operations = []
|
|
966
|
+
Try {
|
|
967
|
+
Set plan = {}.%FromJSON(pPlan)
|
|
968
|
+
Set operations = plan.%Get("operations")
|
|
969
|
+
Set production = ##class(Ens.Config.Production).%OpenId(pProductionName)
|
|
970
|
+
If '$IsObject(production) {
|
|
971
|
+
Set loaded = ##class(Ens.Config.Production).LoadFromClass(pProductionName)
|
|
972
|
+
If $IsObject(loaded) {
|
|
973
|
+
Set production = loaded
|
|
974
|
+
} Else {
|
|
975
|
+
$$$ThrowStatus($$$ERROR($$$EnsErrGeneral,"Production could not be loaded: "_pProductionName))
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
If $IsObject(operations) {
|
|
979
|
+
For i=0:1:operations.%Size()-1 {
|
|
980
|
+
Set operation = operations.%Get(i)
|
|
981
|
+
Set opResult = {}
|
|
982
|
+
Set opResult.id = operation.%Get("id")
|
|
983
|
+
Set opResult."op_type" = operation.%Get("op_type")
|
|
984
|
+
Set opResult.path = operation.%Get("path")
|
|
985
|
+
Set risk = operation.%Get("risk")
|
|
986
|
+
If risk = "unsupported" {
|
|
987
|
+
Set opResult.status = "skipped"
|
|
988
|
+
Set opResult.message = $Select(operation.%Get("reason")'="":operation.%Get("reason"),1:"unsupported operation")
|
|
989
|
+
} ElseIf (risk = "destructive") && ('pAllowDestructive) {
|
|
990
|
+
Set opResult.status = "skipped"
|
|
991
|
+
Set opResult.message = "requires allow_destructive"
|
|
992
|
+
} Else {
|
|
993
|
+
Try {
|
|
994
|
+
$$$ThrowOnError(..ApplyProductionPlanOperation(production, operation))
|
|
995
|
+
Set opResult.status = "applied"
|
|
996
|
+
} Catch opEx {
|
|
997
|
+
Set opResult.status = "failed"
|
|
998
|
+
Set opResult.message = opEx.DisplayString()
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
Do result.operations.%Push(opResult)
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
$$$ThrowOnError(production.SaveToClass())
|
|
1005
|
+
$$$ThrowOnError($System.OBJ.Compile(pProductionName,"k-d"))
|
|
1006
|
+
} Catch ex {
|
|
1007
|
+
Set result.error = ex.DisplayString()
|
|
1008
|
+
}
|
|
1009
|
+
Return result.%ToJSON()
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
ClassMethod ApplyProductionPlanOperation(
|
|
1013
|
+
pProduction As Ens.Config.Production,
|
|
1014
|
+
pOperation) As %Status [ Internal, Private ]
|
|
1015
|
+
{
|
|
1016
|
+
Set opType = pOperation.%Get("op_type")
|
|
1017
|
+
If opType = "add_item" {
|
|
1018
|
+
Return ..ApplyPlanAddItem(pProduction,pOperation)
|
|
1019
|
+
}
|
|
1020
|
+
If opType = "delete_item" {
|
|
1021
|
+
Return ..ApplyPlanDeleteItem(pProduction,pOperation.%Get("item"))
|
|
1022
|
+
}
|
|
1023
|
+
If opType = "set_item_field" {
|
|
1024
|
+
Return ..ApplyPlanSetItemField(pProduction,pOperation)
|
|
1025
|
+
}
|
|
1026
|
+
If opType = "replace_item_class" {
|
|
1027
|
+
Return ..ApplyPlanSetItemField(pProduction,pOperation)
|
|
1028
|
+
}
|
|
1029
|
+
If opType = "set_production_field" {
|
|
1030
|
+
Return ..ApplyPlanSetProductionField(pProduction,pOperation)
|
|
1031
|
+
}
|
|
1032
|
+
If opType = "set_setting" {
|
|
1033
|
+
If pOperation.%Get("target") = "Other" {
|
|
1034
|
+
Return ..ReplaceOtherSettings(..FindProductionItem(pProduction,pOperation.%Get("item")),pOperation.%Get("after"))
|
|
1035
|
+
}
|
|
1036
|
+
Return ..SetConfigSetting(..FindProductionItem(pProduction,pOperation.%Get("item")),pOperation.%Get("target"),pOperation.%Get("setting"),pOperation.%Get("after"))
|
|
1037
|
+
}
|
|
1038
|
+
If opType = "remove_setting" {
|
|
1039
|
+
Return ..RemoveConfigSetting(..FindProductionItem(pProduction,pOperation.%Get("item")),pOperation.%Get("target"),pOperation.%Get("setting"))
|
|
1040
|
+
}
|
|
1041
|
+
If opType = "set_route_setting" {
|
|
1042
|
+
Return ..SetConfigSetting(..FindProductionItem(pProduction,pOperation.%Get("source_item")),"Host",pOperation.%Get("source_target_setting"),..DynamicArrayToCSV(pOperation.%Get("after")))
|
|
1043
|
+
}
|
|
1044
|
+
If opType = "remove_route" {
|
|
1045
|
+
Return ..RemoveConfigSetting(..FindProductionItem(pProduction,pOperation.%Get("source_item")),"Host",pOperation.%Get("source_target_setting"))
|
|
1046
|
+
}
|
|
1047
|
+
Quit $$$ERROR($$$EnsErrGeneral,"Unsupported production plan operation: "_opType)
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
ClassMethod ApplyPlanAddItem(
|
|
1051
|
+
pProduction As Ens.Config.Production,
|
|
1052
|
+
pOperation) As %Status [ Internal, Private ]
|
|
1053
|
+
{
|
|
1054
|
+
Set itemName = pOperation.%Get("item")
|
|
1055
|
+
If itemName = "" {
|
|
1056
|
+
Quit $$$ERROR($$$EnsErrGeneral,"Plan item name is required.")
|
|
1057
|
+
}
|
|
1058
|
+
If $IsObject(..FindProductionItem(pProduction,itemName,0)) {
|
|
1059
|
+
Quit $$$ERROR($$$EnsErrGeneral,"Production item already exists: "_itemName)
|
|
1060
|
+
}
|
|
1061
|
+
Set data = pOperation.%Get("after")
|
|
1062
|
+
Set item = ##class(Ens.Config.Item).%New()
|
|
1063
|
+
Set item.Name = itemName
|
|
1064
|
+
Set item.ClassName = data.%Get("class_name")
|
|
1065
|
+
Set item.Category = data.%Get("category")
|
|
1066
|
+
Set item.PoolSize = +data.%Get("pool_size")
|
|
1067
|
+
Set item.Enabled = ..BooleanValue(data.%Get("enabled"))
|
|
1068
|
+
Set item.Foreground = ..BooleanValue(data.%Get("foreground"))
|
|
1069
|
+
Set item.Comment = data.%Get("comment")
|
|
1070
|
+
Set item.LogTraceEvents = ..BooleanValue(data.%Get("log_trace_events"))
|
|
1071
|
+
Set item.Schedule = data.%Get("schedule")
|
|
1072
|
+
Set item.Production = pProduction
|
|
1073
|
+
$$$ThrowOnError(..SetSettingsFromMap(item,"Host",data.%Get("host_settings")))
|
|
1074
|
+
$$$ThrowOnError(..SetSettingsFromMap(item,"Adapter",data.%Get("adapter_settings")))
|
|
1075
|
+
$$$ThrowOnError(..ReplaceOtherSettings(item,data.%Get("other_settings")))
|
|
1076
|
+
Do pProduction.Items.Insert(item)
|
|
1077
|
+
Quit $$$OK
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
ClassMethod ApplyPlanDeleteItem(
|
|
1081
|
+
pProduction As Ens.Config.Production,
|
|
1082
|
+
pItemName As %String) As %Status [ Internal, Private ]
|
|
1083
|
+
{
|
|
1084
|
+
Set index = ..FindProductionItemIndex(pProduction,pItemName)
|
|
1085
|
+
If index < 1 {
|
|
1086
|
+
Quit $$$OK
|
|
1087
|
+
}
|
|
1088
|
+
Do pProduction.Items.RemoveAt(index)
|
|
1089
|
+
Quit $$$OK
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
ClassMethod ApplyPlanSetItemField(
|
|
1093
|
+
pProduction As Ens.Config.Production,
|
|
1094
|
+
pOperation) As %Status [ Internal, Private ]
|
|
1095
|
+
{
|
|
1096
|
+
Set item = ..FindProductionItem(pProduction,pOperation.%Get("item"))
|
|
1097
|
+
Set field = pOperation.%Get("field")
|
|
1098
|
+
Set value = pOperation.%Get("after")
|
|
1099
|
+
If field = "class_name" {
|
|
1100
|
+
Set item.ClassName = value
|
|
1101
|
+
} ElseIf field = "category" {
|
|
1102
|
+
Set item.Category = value
|
|
1103
|
+
} ElseIf field = "pool_size" {
|
|
1104
|
+
Set item.PoolSize = +value
|
|
1105
|
+
} ElseIf field = "enabled" {
|
|
1106
|
+
Set item.Enabled = ..BooleanValue(value)
|
|
1107
|
+
} ElseIf field = "foreground" {
|
|
1108
|
+
Set item.Foreground = ..BooleanValue(value)
|
|
1109
|
+
} ElseIf field = "comment" {
|
|
1110
|
+
Set item.Comment = value
|
|
1111
|
+
} ElseIf field = "log_trace_events" {
|
|
1112
|
+
Set item.LogTraceEvents = ..BooleanValue(value)
|
|
1113
|
+
} ElseIf field = "schedule" {
|
|
1114
|
+
Set item.Schedule = value
|
|
1115
|
+
} Else {
|
|
1116
|
+
Quit $$$ERROR($$$EnsErrGeneral,"Unsupported item field: "_field)
|
|
1117
|
+
}
|
|
1118
|
+
Quit $$$OK
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
ClassMethod ApplyPlanSetProductionField(
|
|
1122
|
+
pProduction As Ens.Config.Production,
|
|
1123
|
+
pOperation) As %Status [ Internal, Private ]
|
|
1124
|
+
{
|
|
1125
|
+
Set field = pOperation.%Get("field")
|
|
1126
|
+
Set value = pOperation.%Get("after")
|
|
1127
|
+
If field = "testing_enabled" {
|
|
1128
|
+
Set pProduction.TestingEnabled = ..BooleanValue(value)
|
|
1129
|
+
} ElseIf field = "log_general_trace_events" {
|
|
1130
|
+
Set pProduction.LogGeneralTraceEvents = ..BooleanValue(value)
|
|
1131
|
+
} ElseIf field = "actor_pool_size" {
|
|
1132
|
+
Set pProduction.ActorPoolSize = +value
|
|
1133
|
+
} ElseIf field = "description" {
|
|
1134
|
+
Set pProduction.Description = value
|
|
1135
|
+
} Else {
|
|
1136
|
+
Set settingName = ..ProductionSettingName(field)
|
|
1137
|
+
If settingName = "" {
|
|
1138
|
+
Quit $$$ERROR($$$EnsErrGeneral,"Unsupported production field: "_field)
|
|
1139
|
+
}
|
|
1140
|
+
$$$ThrowOnError(..SetConfigSetting(pProduction,"",settingName,value))
|
|
1141
|
+
}
|
|
1142
|
+
Quit $$$OK
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
ClassMethod ProductionSettingName(pField As %String) As %String [ Internal, Private ]
|
|
1146
|
+
{
|
|
1147
|
+
Quit $Select(
|
|
1148
|
+
pField="shutdown_timeout":"ShutdownTimeout",
|
|
1149
|
+
pField="update_timeout":"UpdateTimeout",
|
|
1150
|
+
pField="alert_notification_manager":"AlertNotificationManager",
|
|
1151
|
+
pField="alert_notification_operation":"AlertNotificationOperation",
|
|
1152
|
+
pField="alert_notification_recipients":"AlertNotificationRecipients",
|
|
1153
|
+
pField="alert_action_window":"AlertActionWindow",
|
|
1154
|
+
1:"")
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
ClassMethod FindProductionItem(
|
|
1158
|
+
pProduction As Ens.Config.Production,
|
|
1159
|
+
pItemName As %String,
|
|
1160
|
+
pThrow As %Boolean = 1) [ Internal, Private ]
|
|
1161
|
+
{
|
|
1162
|
+
Set index = ..FindProductionItemIndex(pProduction,pItemName)
|
|
1163
|
+
If index > 0 {
|
|
1164
|
+
Quit pProduction.Items.GetAt(index)
|
|
1165
|
+
}
|
|
1166
|
+
If pThrow {
|
|
1167
|
+
$$$ThrowStatus($$$ERROR($$$EnsErrGeneral,"Production item does not exist: "_pItemName))
|
|
1168
|
+
}
|
|
1169
|
+
Quit ""
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
ClassMethod FindProductionItemIndex(
|
|
1173
|
+
pProduction As Ens.Config.Production,
|
|
1174
|
+
pItemName As %String) As %Integer [ Internal, Private ]
|
|
1175
|
+
{
|
|
1176
|
+
For i=1:1:pProduction.Items.Count() {
|
|
1177
|
+
Set item = pProduction.Items.GetAt(i)
|
|
1178
|
+
If $IsObject(item), item.Name = pItemName {
|
|
1179
|
+
Return i
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
Quit 0
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
ClassMethod SetSettingsFromMap(
|
|
1186
|
+
pOwner,
|
|
1187
|
+
pTarget As %String,
|
|
1188
|
+
pMap) As %Status [ Internal, Private ]
|
|
1189
|
+
{
|
|
1190
|
+
If '$IsObject(pMap) {
|
|
1191
|
+
Quit $$$OK
|
|
1192
|
+
}
|
|
1193
|
+
Set iterator = pMap.%GetIterator()
|
|
1194
|
+
While iterator.%GetNext(.key,.value) {
|
|
1195
|
+
$$$ThrowOnError(..SetConfigSetting(pOwner,pTarget,key,value))
|
|
1196
|
+
}
|
|
1197
|
+
Quit $$$OK
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
ClassMethod SetConfigSetting(
|
|
1201
|
+
pOwner,
|
|
1202
|
+
pTarget As %String,
|
|
1203
|
+
pName As %String,
|
|
1204
|
+
pValue) As %Status [ Internal, Private ]
|
|
1205
|
+
{
|
|
1206
|
+
Set index = ..FindConfigSettingIndex(pOwner,pTarget,pName)
|
|
1207
|
+
If index > 0 {
|
|
1208
|
+
Set setting = pOwner.Settings.GetAt(index)
|
|
1209
|
+
} Else {
|
|
1210
|
+
Set setting = ##class(Ens.Config.Setting).%New()
|
|
1211
|
+
Set setting.Target = pTarget
|
|
1212
|
+
Set setting.Name = pName
|
|
1213
|
+
Do pOwner.Settings.Insert(setting)
|
|
1214
|
+
}
|
|
1215
|
+
Set setting.Value = pValue
|
|
1216
|
+
Quit $$$OK
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
ClassMethod RemoveConfigSetting(
|
|
1220
|
+
pOwner,
|
|
1221
|
+
pTarget As %String,
|
|
1222
|
+
pName As %String) As %Status [ Internal, Private ]
|
|
1223
|
+
{
|
|
1224
|
+
Set index = ..FindConfigSettingIndex(pOwner,pTarget,pName)
|
|
1225
|
+
If index > 0 {
|
|
1226
|
+
Do pOwner.Settings.RemoveAt(index)
|
|
1227
|
+
}
|
|
1228
|
+
Quit $$$OK
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
ClassMethod ReplaceOtherSettings(
|
|
1232
|
+
pOwner,
|
|
1233
|
+
pSettings) As %Status [ Internal, Private ]
|
|
1234
|
+
{
|
|
1235
|
+
For i=pOwner.Settings.Count():-1:1 {
|
|
1236
|
+
Set setting = pOwner.Settings.GetAt(i)
|
|
1237
|
+
If $IsObject(setting), setting.Target '= "Host", setting.Target '= "Adapter" {
|
|
1238
|
+
Do pOwner.Settings.RemoveAt(i)
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
If '$IsObject(pSettings) {
|
|
1242
|
+
Quit $$$OK
|
|
1243
|
+
}
|
|
1244
|
+
For i=0:1:pSettings.%Size()-1 {
|
|
1245
|
+
Set data = pSettings.%Get(i)
|
|
1246
|
+
Set setting = ##class(Ens.Config.Setting).%New()
|
|
1247
|
+
Set setting.Target = ..DynamicGet(data,"@Target","")
|
|
1248
|
+
Set setting.Name = ..DynamicGet(data,"@Name","")
|
|
1249
|
+
Set setting.Value = ..DynamicGet(data,"#text","")
|
|
1250
|
+
Do pOwner.Settings.Insert(setting)
|
|
1251
|
+
}
|
|
1252
|
+
Quit $$$OK
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
ClassMethod FindConfigSettingIndex(
|
|
1256
|
+
pOwner,
|
|
1257
|
+
pTarget As %String,
|
|
1258
|
+
pName As %String) As %Integer [ Internal, Private ]
|
|
1259
|
+
{
|
|
1260
|
+
For i=1:1:pOwner.Settings.Count() {
|
|
1261
|
+
Set setting = pOwner.Settings.GetAt(i)
|
|
1262
|
+
If $IsObject(setting), setting.Target = pTarget, setting.Name = pName {
|
|
1263
|
+
Return i
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
Quit 0
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
ClassMethod DynamicArrayToCSV(pArray) As %String [ Internal, Private ]
|
|
1270
|
+
{
|
|
1271
|
+
If '$IsObject(pArray) {
|
|
1272
|
+
Quit pArray
|
|
1273
|
+
}
|
|
1274
|
+
Set value = ""
|
|
1275
|
+
For i=0:1:pArray.%Size()-1 {
|
|
1276
|
+
If value '= "" {
|
|
1277
|
+
Set value = value_","
|
|
1278
|
+
}
|
|
1279
|
+
Set value = value_pArray.%Get(i)
|
|
1280
|
+
}
|
|
1281
|
+
Quit value
|
|
1282
|
+
}
|
|
1283
|
+
|
|
477
1284
|
ClassMethod dispatchTestComponent(
|
|
478
1285
|
pTargetName As %String,
|
|
479
1286
|
pInput As Ens.Request) As Ens.Response
|