-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathInstaller.cls
59 lines (50 loc) · 1.84 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
Include %occInclude
Class Anonymizer.Installer
{
Parameter NAMESPACE As %String = "APPL";
XData Install [ XMLNamespace = INSTALLER ]
{
<Manifest>
<Log Text="Creating ${NAMESPACE} namespace and DB..." Level="0"/>
<Default Name="RESOURCE" Value="%DB_${NAMESPACE}" />
<Namespace Name="${NAMESPACE}" Code="${NAMESPACE}" Data="${NAMESPACE}" Create="yes" Ensemble="0">
<Configuration>
<Database Name="${NAMESPACE}" Dir="${MGRDIR}${DBNAME}" Create="yes" MountAtStartup="true"/>
</Configuration>
<IfDef Var="SOURCE">
<Log Text="SOURCE defined - offline install from ${SOURCE}" Level="0"/>
<Import File="${SOURCE}" Recurse="true"/>
</IfDef>
</Namespace>
</Manifest>
}
/// This is a method generator whose code is generated by XGL.
ClassMethod Installer(ByRef pVars, pLogLevel As %Integer = 3, pInstaller As %Installer.Installer, pLogger As %Installer.AbstractLogger) As %Status [ CodeMode = objectgenerator, Internal ]
{
return ##class(%Installer.Manifest).%Generate(%compiledclass,%code,"Install")
}
ClassMethod Install(path As %String) As %Status
{
set sc = $$$OK
try {
set args("NAMESPACE") = ..#NAMESPACE
set args("DBNAME") = $zconvert(..#NAMESPACE,"L")
set args("SOURCE") = path
#; install manifest
set sc = $$$ADDSC(sc,..Installer(.args))
set csp = ##class(Security.Applications).%New()
set csp.Description = "CSV Anonymizer Application"
set csp.Enabled = 1
set csp.Name = "/appl"
set csp.NameSpace = "APPL"
set csp.AutoCompile = 1
set csp.AutheEnabled = 64
set csp.Path = "/usr/irissys/csp/"
do csp.MatchRoles.Insert(":%All")
set sc = $$$ADDSC(sc,csp.%Save())
} catch (err) {
set sc = $$$ADDSC(sc,err.AsStatus())
}
return sc
}
}