-
Notifications
You must be signed in to change notification settings - Fork 2
/
Installer.cls
98 lines (76 loc) · 2.78 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
Include %occInclude
Class App.Installer
{
XData setup
{
<Manifest>
<Default Name="NAMESPACE" Value="IRISAPP"/>
<Default Name="DBNAME" Value="IRISAPP"/>
<Default Name="APPPATH" Dir="/opt/irisapp/" />
<Default Name="SOURCESPATH" Dir="${APPPATH}src" />
<Default Name="CSPURL" Value="/csp/irisapp" />
<Default Name="RESOURCE" Value="%DB_${DBNAME}" />
<Resource Name="%DB_${DBNAME}" Description="Resource for Message Viewer application" Permission="RW"/>
<Namespace Name="${NAMESPACE}" Code="${DBNAME}" Data="${DBNAME}" Create="yes" Ensemble="0">
<Configuration>
<Database Name="${DBNAME}" Dir="${APPPATH}data" Create="yes" Resource="${RESOURCE}" MountAtStartup="true"/>
</Configuration>
<CSPApplication Url="${CSPURL}" Directory="${APPPATH}csp/" ServeFiles="1" Recurse="1" Grant="%DB_${NAMESPACE},%SQL" AuthenticationMethods="32" />
<Import File="${SOURCESPATH}/cls" Recurse="1"/>
</Namespace>
</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 SetAppProperties(pApp As %String, pPath As %String) As %Status
{
New $Namespace
Set $Namespace = "%SYS"
Set tSC = ##class(Security.Applications).Get(pApp, .webProperties)
If $$$ISERR(tSC) {
Quit tSC
}
Set webProperties("Path") = pPath
Set webProperties("Resource") = ""
Set webProperties("AutheEnabled") = 32
Set webProperties("AutoCompile") = 1
Set webProperties("ServeFiles") = 1
Set webProperties("iKnowEnabled") = 1
Set webProperties("DeepSeeEnabled") = 1
Set tSC = ##class(Security.Applications).Modify(pApp, .webProperties)
Quit tSC
}
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 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.REST.Dispatch"
Set props("MatchRoles")=":%All"
Set sc = ##class(Security.Applications).Create(appName, .props)
}
Quit sc
}
ClassMethod CreateFavorite() As %Status
{
New $Namespace
Set $Namespace = "IRISAPP"
Set status = ##class(diashenrique.util.Favorite).%AddFavorite("AnalyticsPortal","/csp/irisapp/analytics.csp")
Quit status
}
}