generated from intersystems-community/objectscript-package-example
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Installer.cls
55 lines (44 loc) · 1.51 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
Class App.Installer
{
XData setup
{
<Manifest>
<Default Name="SourceDir" Value="#{$system.Process.CurrentDirectory()}src"/>
<Default Name="Namespace" Value="IRISAPP"/>
<Default Name="app" Value="forms-angular" />
<Namespace Name="${Namespace}" Code="${Namespace}" Data="${Namespace}" Create="yes" Ensemble="no">
<Configuration>
<Database Name="${Namespace}" Dir="/opt/${app}/data" Create="yes" Resource="%DB_${Namespace}"/>
</Configuration>
<CSPApplication Url="/csp/${app}"
Directory="${cspdir}${app}"
ServeFiles="1"
Recurse="1"
Grant="%DB_${Namespace},%SQL"
AuthenticationMethods="32"
/>
</Namespace>
<Invoke Class="App.Installer" Method="SetDispatchClass">
<Arg Value="${restapp}"/>
<Arg Value="community.objectscript.RESTExample"/>
</Invoke>
</Manifest>
}
ClassMethod setup(ByRef pVars, pLogLevel As %Integer = 3, pInstaller As %Installer.Installer, pLogger As %Installer.AbstractLogger) As %Status [ CodeMode = objectgenerator, Internal ]
{
#; Let XGL document generate code for this method.
Quit ##class(%Installer.Manifest).%Generate(%compiledclass, %code, "setup")
}
ClassMethod SetDispatchClass(pApp As %String, pClass As %String) As %Status
{
New $Namespace
Set $Namespace = "%SYS"
Set tSC = ##class(Security.Applications).Get(pApp, .webProperties)
If $$$ISERR(tSC) {
Quit tSC
}
Set webProperties("DispatchClass") = pClass
Set tSC = ##class(Security.Applications).Modify(pApp, .webProperties)
Quit tSC
}
}