-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerInstaller.cls
116 lines (99 loc) · 4.75 KB
/
DockerInstaller.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
Include %occInclude
/// Simple example of installation instructions (Manifest)
Class SampleApps.Synch.Config.Installer
{
XData SynchManifest [ XMLNamespace = INSTALLER ]
{
<Manifest>
<Default Name="NamespaceMaster" Value="MASTER"/>
<Default Name="MasterAppREST" Value="/synchmaster/rest/v1" />
<Default Name="ClientAppREST" Value = "/synchclient/rest/v1" />
<Default Name="InstallingFromNS" Value="USER"/>
<Default Name="SourceCodeFolder" Value="SampleApps"/>
<Default Name="InstallDir" Value="/home/irisowner/dev"/>
<Default Name="NamespaceClient" Value="CLIENT" />
<Default Name="Resource" Value="%DB_DEFAULT"/>
<Var Name="GlobalMaster" Value="${NamespaceMaster}DB"/>
<Var Name="GlobalClient" Value="${NamespaceClient}DB"/>
<Var Name="DispatchClass" Value="SampleApps.Synch.API.v1.RestLegacy"/>
<Log Level="3" Text="Defining MASTER namespace and DBs..."/>
<Namespace Name="${NamespaceMaster}" Create="overwrite" Ensemble="0" Code="${GlobalMaster}" Data="${GlobalMaster}">
<Configuration>
<Database Name="${GlobalMaster}" Create="overwrite" Dir="${InstallDir}/${GlobalMaster}" Resource="${Resource}"/>
<Database Name="${GlobalClient}" Create="overwrite" Dir="${InstallDir}/${GlobalClient}" Resource="${Resource}" />
</Configuration>
<Log Level="3" Text="Importing source code..."/>
<Import File="${InstallDir}/${SourceCodeFolder}" Recurse="1"/>
<CSPApplication Url="${MasterAppREST}" Description="API for Synch Sample" DispatchClass="${DispatchClass}" Directory="${InstallDir}/${GlobalMaster}/rest/v1" CSPZENEnabled="1" Grant="%DB_%DEFAULT" CookiePath="${MasterAppREST}" AuthenticationMethods="32"/>
<Invoke Class="SampleApps.Synch.Util" Method="Restart" />
</Namespace>
<Log Level="3" Text="Dismounting databases temporarely..."/>
<Invoke Class="SYS.Database" Method="DismountDatabase" CheckStatus="1" Return="tDismountSC">
<Arg Value="${InstallDir}/${GlobalMaster}" />
</Invoke>
<Invoke Class="SYS.Database" Method="DismountDatabase" CheckStatus="0" Return="tDismountSC">
<Arg Value="${InstallDir}/${GlobalClient}" />
</Invoke>
<Log Level="3" Text="Replicating data from MASTER to CLIENT..."/>
<CopyDir Src="${InstallDir}/${GlobalMaster}" Target="${InstallDir}/${GlobalClient}"/>
<Log Level="3" Text="Mounting databases..."/>
<Invoke Class="SYS.Database" Method="MountDatabase" CheckStatus="1" Return="tMountSC">
<Arg Value="${InstallDir}/${GlobalMaster}" />
</Invoke>
<Invoke Class="SYS.Database" Method="MountDatabase" CheckStatus="1" Return="tMountSC">
<Arg Value="${InstallDir}/${GlobalClient}" />
</Invoke>
<Log Level="3" Text="Defining CLIENT namespace..." />
<Namespace Name="${NamespaceClient}" Create="overwrite" Ensemble="0" Code="${GlobalClient}" Data="${GlobalClient}">
<Configuration>
<Database Name="${GlobalClient}" Create="no" Dir="${InstallDir}/${GlobalClient}" Resource="${Resource}" />
</Configuration>
<CSPApplication Url="${ClientAppREST}" Description="API for Synch Sample" DispatchClass="${DispatchClass}" Directory="${InstallDir}/${GlobalClient}/rest/v1" CSPZENEnabled="1" Grant="%DB_%DEFAULT" CookiePath="${ClientAppREST}" AuthenticationMethods="32"/>
</Namespace>
<Log Level="3" Text="Configuring Web Apps as REST server end-point..."/>
<Namespace Name="${InstallingFromNS}" Create="no">
<Invoke Class="SampleApps.Synch.Config.Installer" Method="CSPAppConfigureAsREST" CheckStatus="1" Return="tRESTappSC">
<Arg Value="${MasterAppREST}" />
<Arg Value="${DispatchClass}" />
</Invoke>
<Invoke Class="SampleApps.Synch.Config.Installer" Method="CSPAppConfigureAsREST" CheckStatus="1" Return="tRESTappSC">
<Arg Value="${ClientAppREST}" />
<Arg Value="${DispatchClass}" />
</Invoke>
</Namespace>
</Manifest>
}
/// This is a method generator whose code is generated by XGL.
ClassMethod setup(ByRef pVars, pLogLevel As %Integer = 3,
pInstaller As %Installer.Installer,
pLogger As %Installer.AbstractLogger)
As %Status [ CodeMode = objectgenerator, Internal ]
{
#; Let our XGL document generate code for this method.
Quit ##class(%Installer.Manifest).%Generate(%compiledclass,
%code, "SynchManifest")
}
ClassMethod CSPAppConfigureAsREST(pApplication as %String,pDispatchClass as %String) as %Status
{
#dim tSC as %Status = $$$OK
#dim e as %Exception.AbstractException
#dim tApp as Security.Applications
try
{
new $namespace
set $namespace = "%SYS"
set tApp = ##class(Security.Applications).%OpenId(pApplication,,.tSC)
set tApp.DispatchClass = pDispatchClass
set tApp.Recurse = 1
set tApp.IsNameSpaceDefault = 0
set tApp.Path=""
set tApp.UseCookies = 1
set tSC = tApp.%Save()
}
catch e
{
set tSC = e.AsStatus()
}
quit tSC
}
}