-
Notifications
You must be signed in to change notification settings - Fork 3
/
Installer.cls
75 lines (60 loc) · 2.24 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
Include %occInclude
Class App.Installer
{
XData MyInstall [ XMLNamespace = INSTALLER ]
{
<Manifest>
<Default Name="NAMESPACE" Value="NPM"/>
<Default Name="DBNAME" Value="NPM"/>
<Default Name="APPPATH" Dir="/opt/irisapp/" />
<Default Name="CSPURL" Dir="/npm" />
<Default Name="RESTPATH" Dir="/npm/api" />
<Default Name="SOURCESPATH" Dir="${APPPATH}src" />
<Default Name="RESOURCE" Value="%DB_${DBNAME}" />
<Resource Name="%DB_NPM" Description="Resource for NPM application" Permission="RW"/>
<Namespace Name="${NAMESPACE}" Code="${DBNAME}" Data="${DBNAME}" Create="yes" Ensemble="0">
<Configuration>
<Database Name="${DBNAME}" Dir="${MGRDIR}data" Create="yes" Resource="${RESOURCE}" MountAtStartup="true"/>
</Configuration>
<CSPApplication Url="${CSPURL}" Directory="${APPPATH}csp/" AuthenticationMethods="64" IsNamespaceDefault="true" Recurse="1" ServeFiles="1"/>
<Import File="${SOURCESPATH}/cls" Recurse="1"/>
</Namespace>
<Invoke Class="App.Installer" Method="createRESTApp">
<Arg Value="${RESTPATH}"/>
<Arg Value="${NAMESPACE}"/>
</Invoke>
<Invoke Class="App.Installer" Method="CompileCSP">
<Arg Value="${CSPURL}"/>
<Arg Value="${NAMESPACE}"/>
</Invoke>
</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")
}
/// Modify web app REST
ClassMethod createRESTApp(appName As %String, pNamespace As %String) As %Status
{
#dim sc As %Status = $$$OK
New $Namespace
Set $Namespace = "%SYS"
If '##class(Security.Applications).Exists(appName) {
Set props("AutheEnabled") = $$$AutheUnauthenticated
Set props("NameSpace") = pNamespace
Set props("IsNameSpaceDefault") = $$$NO
Set props("DispatchClass") = "diashenrique.npm.REST.Dispatch"
Set props("MatchRoles")=":%All"
Set sc = ##class(Security.Applications).Create(appName, .props)
}
Quit sc
}
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
}
}