-
Notifications
You must be signed in to change notification settings - Fork 11
/
Installer.cls
77 lines (56 loc) · 2.23 KB
/
Installer.cls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
Include %occInclude
Class App.Installer
{
XData MyInstall [ XMLNamespace = INSTALLER ]
{
<Manifest>
<Default Name="NAMESPACE" Value="IRISMONITOR"/>
<Default Name="DBNAME" Value="IRISMONITOR"/>
<Default Name="APPPATH" Dir="/opt/irisapp/" />
<Default Name="SOURCESPATH" Dir="${APPPATH}src" />
<Default Name="CSPURL" Value="/csp/irismonitor" />
<Default Name="RESOURCE" Value="%DB_${DBNAME}" />
<Resource Name="${RESOURCE}" Description="Resource for IRIS History Monitor" Permission="RW"/>
<Resource Name="%DB_IRISSYS" Description="The System database" Permission="R"/>
<Namespace Name="${NAMESPACE}" Code="${DBNAME}" Data="${DBNAME}" Create="yes" Ensemble="0">
<Configuration>
<Database Name="${DBNAME}" Dir="${APPPATH}${DBNAME}" Create="yes" Resource="${RESOURCE}"/>
</Configuration>
<CSPApplication Url="${CSPURL}" Directory="${APPPATH}csp/" AuthenticationMethods="32" IsNamespaceDefault="true" ServeFiles="1" Recurse="1" />
<Import File="${SOURCESPATH}/cls" Recurse="1"/>
</Namespace>
<Invoke Class="App.Installer" Method="CompileCSP">
<Arg Value="${CSPURL}"/>
<Arg Value="${NAMESPACE}"/>
</Invoke>
<Invoke Class="App.Installer" Method="CustomApplicationMetrics" />
<Invoke Class="App.Installer" Method="CreateFavorite" />
</Manifest>
}
ClassMethod setup(ByRef pVars, pLogLevel As %Integer = 3, pInstaller As %Installer.Installer, pLogger As %Installer.AbstractLogger) As %Status [ CodeMode = objectgenerator, Internal ]
{
Quit ##class(%Installer.Manifest).%Generate(%compiledclass, %code, "MyInstall")
}
ClassMethod CompileCSP(pApp As %String, pNamespace As %String) As %Status
{
New $Namespace
Set $Namespace = pNamespace
Set list(pApp_"/*.csp") = ""
Do $System.OBJ.CompileList(.list,"ck")
Quit $$$OK
}
ClassMethod CustomApplicationMetrics() As %Status
{
New $Namespace
Set $Namespace = "%SYS"
Set status = ##class(SYS.Monitor.SAM.Config).AddApplicationClass("diashenrique.historymonitor.util.customSensors","IRISMONITOR")
Quit status
}
ClassMethod CreateFavorite() As %Status
{
New $Namespace
Set $Namespace = "IRISMONITOR"
Set status = ##class(diashenrique.historymonitor.util.Favorite).%AddFavorite("HistoryMonitor","/csp/irismonitor/dashboard.csp")
Quit status
}
}