-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9af76a3
commit 714fe67
Showing
20 changed files
with
638 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
csp/.idea | ||
csp/.idea | ||
.idea | ||
node_modules | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,185 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Export generator="Cache" version="25" zv="Cache for Windows (x86-64) 2017.1 (Build 792U)" ts="2017-08-18 17:12:53"> | ||
<Class name="SQLKPI.Installer"> | ||
<TimeChanged>64513,61955.639014</TimeChanged> | ||
<TimeCreated>64513,60278.826343</TimeCreated> | ||
|
||
<XData name="Install"> | ||
<XMLNamespace>INSTALLER</XMLNamespace> | ||
<Data><![CDATA[ | ||
<Manifest> | ||
<IfNotDef Var="Namespace"> | ||
<Var Name="Namespace" Value="SQLKPI"/> | ||
<Log Text="Set namespace to ${Namespace}" Level="0"/> | ||
</IfNotDef> | ||
<If Condition='(##class(Config.Namespaces).Exists("${Namespace}")=0)'> | ||
<Log Text="Creating namespace ${Namespace}" Level="0"/> | ||
<Namespace Name="${Namespace}" Create="yes" Code="${Namespace}" Ensemble="0" Data="${Namespace}"> | ||
<Configuration> | ||
<Database Name="${Namespace}" Dir="${MGRDIR}${Namespace}" Create="yes"/> | ||
</Configuration> | ||
</Namespace> | ||
<Log Text="End Creating namespace ${Namespace}" Level="0"/> | ||
</If> | ||
<Role Name="SQLKPIRole" Description="Role to access and use the SQLKPI" Resources="%DB_CACHESYS:RW,%Admin_Secure:U" /> | ||
<Namespace Name="${Namespace}" Create="no"> | ||
<RunInstall Class="SQLKPI.Installer" Method="CopyClasses"/> | ||
<RunInstall Class="SQLKPI.Installer" Method="CreateApplication"/> | ||
<CSPApplication Url="/csp/sqlkpi" Recurse="1" Directory="${CSPDIR}sqlkpi" AuthenticationMethods="64" IsNamespaceDefault="true" Grant="AppRole" /> | ||
<Log Text="Copying web application files" Level="0"/> | ||
<RunInstall Class="SQLKPI.Installer" Method="CopyFiles"/> | ||
</Namespace> | ||
<If Condition='(##class(Config.Namespaces).Exists("%All")=0)'> | ||
<Log Text="Creating namespace %All" Level="0"/> | ||
<Namespace Name="%All" Create="yes" Code="CACHETEMP" Data="CACHETEMP" Ensemble="0"> | ||
<Configuration> | ||
<Log Text="Mapping SQLKPI package to %All namespace" Level="0"/> | ||
<ClassMapping From="${Namespace}" Package="SQLKPI"/> | ||
</Configuration> | ||
</Namespace> | ||
</If> | ||
<If Condition='(##class(Config.Namespaces).Exists("%All")=1)'> | ||
<Namespace Name="%All" Create="no" Code="CACHETEMP" Data="CACHETEMP" Ensemble="0"> | ||
<Configuration> | ||
<Log Text="Mapping package SQLKPI to %All namespace" Level="0"/> | ||
<ClassMapping From="${Namespace}" Package="SQLKPI"/> | ||
</Configuration> | ||
</Namespace> | ||
</If> | ||
<Log Text="Mapping SQLKPI package to Samples namespace" Level="0"/> | ||
<If Condition='##class(Config.Namespaces).Exists("Samples")'> | ||
<Namespace Name="Samples" Create="no" Code="SAMPLES" Data="SAMPLES" Ensemble="0"> | ||
<Configuration> | ||
<ClassMapping From="${Namespace}" Package="SQLKPI"/> | ||
</Configuration> | ||
</Namespace> | ||
</If> | ||
</Manifest> | ||
]]></Data> | ||
</XData> | ||
|
||
<Method name="setup"> | ||
<Internal>1</Internal> | ||
<ClassMethod>1</ClassMethod> | ||
<CodeMode>objectgenerator</CodeMode> | ||
<FormalSpec><![CDATA[&pVars,pLogLevel:%Integer=0,pInstaller:%Installer.Installer]]></FormalSpec> | ||
<ReturnType>%Status</ReturnType> | ||
<Implementation><![CDATA[ Quit ##class(%Installer.Manifest).%Generate(%compiledclass, %code, "Install") | ||
]]></Implementation> | ||
</Method> | ||
|
||
<Method name="CreateApplication"> | ||
<ClassMethod>1</ClassMethod> | ||
<FormalSpec>pVars,pLogLevel,tInstaller</FormalSpec> | ||
<Implementation><![CDATA[ | ||
set Namespace = tInstaller.Evaluate("${Namespace}") | ||
do tInstaller.PushNS("%SYS") | ||
if ('##class(Security.Applications).Exists("/sqlkpi")) { | ||
set cspProperties("NameSpace") = Namespace | ||
set cspProperties("AutheEnabled") = $$$AutheCache | ||
set cspProperties("IsNameSpaceDefault") = $$$NO | ||
set cspProperties("DispatchClass") = "SQLKPI.REST" | ||
set cspProperties("GroupById") = "sqlkpi" | ||
set cspProperties("MatchRoles") = ":SQLKPIRole" | ||
set cspProperties("CookiePath") = "/" | ||
set tSC = ##class(Security.Applications).Create("/sqlkpi", .cspProperties) | ||
if $$$ISERR(tSC) throw ##class(%Installer.Exception).CreateFromStatus(tSC) | ||
kill cspProperties | ||
} | ||
do tInstaller.PopNS() | ||
quit $$$OK | ||
]]></Implementation> | ||
</Method> | ||
|
||
<Method name="CopyClasses"> | ||
<ClassMethod>1</ClassMethod> | ||
<FormalSpec>pVars,pLogLevel,tInstaller</FormalSpec> | ||
<Implementation><![CDATA[ | ||
set sc = $$$OK | ||
set i = 0 | ||
while 1 { | ||
set id = "SQLKPI.CLSData||File" _ i | ||
if (##class(%Dictionary.CompiledXData).%ExistsId(id) = 0) Q | ||
set class = ##class(%Dictionary.CompiledXData).%OpenId(id) | ||
set data = $zconvert(class.Data.Read(class.Data.Size), "O", "UTF8") | ||
set className = "SQLKPI."_$piece(class.Description,".",1) | ||
set Namespace = tInstaller.Evaluate("${Namespace}") | ||
do tInstaller.PushNS(Namespace) | ||
if ('##class(%Dictionary.ClassDefinition).%ExistsId(className)) { | ||
set clsDef = ##class(%Dictionary.ClassDefinition).%New() | ||
set clsDef.Name = className | ||
set sc = clsDef.%Save() | ||
quit:$$$ISERR(sc) | ||
} | ||
set sc = ##class(%Compiler.UDL.TextServices).SetTextFromString(,className,$System.Encryption.Base64Decode(data)) | ||
do $system.OBJ.Compile(className, "cuk") | ||
do tInstaller.PopNS() | ||
set i = i + 1 | ||
} | ||
quit $$$OK | ||
]]></Implementation> | ||
</Method> | ||
|
||
<Method name="CopyFiles"> | ||
<ClassMethod>1</ClassMethod> | ||
<FormalSpec>pVars,pLogLevel,tInstaller</FormalSpec> | ||
<Implementation><![CDATA[ | ||
set csp = tInstaller.Evaluate("${CSPDIR}") | ||
set path = ##class(%File).NormalizeDirectory(csp _ "sqlkpi") | ||
// Get path separator | ||
set r = ##class(%File).NormalizeDirectory("\") | ||
if ($find(r, "/") = 0) { | ||
set r = "\" | ||
} else { | ||
set r = "/" | ||
} | ||
set i = 0 | ||
while 1 { | ||
set id = "SQLKPI.CSPData||File" _ i | ||
if (##class(%Dictionary.CompiledXData).%ExistsId(id) = 0) Q | ||
set file = ##class(%Dictionary.CompiledXData).%OpenId(id) | ||
set data = $zconvert(file.Data.Read(file.Data.Size), "O", "UTF8") | ||
set fileName = ##class(%File).NormalizeFilename(path _ file.Description) | ||
set fileName = $replace(fileName, "\", r) | ||
set fileName = $replace(fileName, "/", r) | ||
set dir = ##class(%File).ParentDirectoryName(fileName) | ||
if ('##class(%File).DirectoryExists(dir)) { | ||
do ##class(%File).CreateDirectory(dir) | ||
} | ||
do tInstaller.Log(pLogLevel, "Creating file", fileName) | ||
set f = ##class(%Stream.FileBinary).%New() | ||
do f.LinkToFile(fileName) | ||
do f.Write($System.Encryption.Base64Decode(data)) | ||
do f.%Save() | ||
set i = i + 1 | ||
} | ||
quit $$$OK | ||
]]></Implementation> | ||
</Method> | ||
</Class> | ||
</Export> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
Class SQLKPI.Installer | ||
{ | ||
|
||
XData Install [ XMLNamespace = INSTALLER ] | ||
{ | ||
<Manifest> | ||
<IfNotDef Var="Namespace"> | ||
<Var Name="Namespace" Value="SQLKPI"/> | ||
<Log Text="Set namespace to ${Namespace}" Level="0"/> | ||
</IfNotDef> | ||
|
||
<If Condition='(##class(Config.Namespaces).Exists("${Namespace}")=0)'> | ||
<Log Text="Creating namespace ${Namespace}" Level="0"/> | ||
<Namespace Name="${Namespace}" Create="yes" Code="${Namespace}" Ensemble="0" Data="${Namespace}"> | ||
<Configuration> | ||
<Database Name="${Namespace}" Dir="${MGRDIR}${Namespace}" Create="yes"/> | ||
</Configuration> | ||
</Namespace> | ||
<Log Text="End Creating namespace ${Namespace}" Level="0"/> | ||
</If> | ||
|
||
<Role Name="SQLKPIRole" Description="Role to access and use the SQLKPI" Resources="%DB_CACHESYS:RW,%Admin_Secure:U" /> | ||
<Namespace Name="${Namespace}" Create="no"> | ||
<RunInstall Class="SQLKPI.Installer" Method="CopyClasses"/> | ||
<RunInstall Class="SQLKPI.Installer" Method="CreateApplication"/> | ||
<CSPApplication Url="/csp/sqlkpi" Recurse="1" Directory="${CSPDIR}sqlkpi" AuthenticationMethods="64" IsNamespaceDefault="true" Grant="AppRole" /> | ||
<Log Text="Copying web application files" Level="0"/> | ||
<RunInstall Class="SQLKPI.Installer" Method="CopyFiles"/> | ||
</Namespace> | ||
|
||
<If Condition='(##class(Config.Namespaces).Exists("%All")=0)'> | ||
<Log Text="Creating namespace %All" Level="0"/> | ||
<Namespace Name="%All" Create="yes" Code="CACHETEMP" Data="CACHETEMP" Ensemble="0"> | ||
<Configuration> | ||
<Log Text="Mapping SQLKPI package to %All namespace" Level="0"/> | ||
<ClassMapping From="${Namespace}" Package="SQLKPI"/> | ||
</Configuration> | ||
</Namespace> | ||
</If> | ||
|
||
<If Condition='(##class(Config.Namespaces).Exists("%All")=1)'> | ||
<Namespace Name="%All" Create="no" Code="CACHETEMP" Data="CACHETEMP" Ensemble="0"> | ||
<Configuration> | ||
<Log Text="Mapping package SQLKPI to %All namespace" Level="0"/> | ||
<ClassMapping From="${Namespace}" Package="SQLKPI"/> | ||
</Configuration> | ||
</Namespace> | ||
</If> | ||
|
||
|
||
<Log Text="Mapping SQLKPI package to Samples namespace" Level="0"/> | ||
<If Condition='##class(Config.Namespaces).Exists("Samples")'> | ||
<Namespace Name="Samples" Create="no" Code="SAMPLES" Data="SAMPLES" Ensemble="0"> | ||
<Configuration> | ||
<ClassMapping From="${Namespace}" Package="SQLKPI"/> | ||
</Configuration> | ||
</Namespace> | ||
</If> | ||
</Manifest> | ||
} | ||
|
||
ClassMethod setup(ByRef pVars, pLogLevel As %Integer = 0, pInstaller As %Installer.Installer) As %Status [ CodeMode = objectgenerator, Internal ] | ||
{ | ||
Quit ##class(%Installer.Manifest).%Generate(%compiledclass, %code, "Install") | ||
} | ||
|
||
ClassMethod CreateApplication(pVars, pLogLevel, tInstaller) | ||
{ | ||
set Namespace = tInstaller.Evaluate("${Namespace}") | ||
do tInstaller.PushNS("%SYS") | ||
if ('##class(Security.Applications).Exists("/sqlkpi")) { | ||
set cspProperties("NameSpace") = Namespace | ||
set cspProperties("AutheEnabled") = $$$AutheCache | ||
set cspProperties("IsNameSpaceDefault") = $$$NO | ||
set cspProperties("DispatchClass") = "SQLKPI.REST" | ||
set cspProperties("GroupById") = "sqlkpi" | ||
set cspProperties("MatchRoles") = ":SQLKPIRole" | ||
set cspProperties("CookiePath") = "/" | ||
|
||
set tSC = ##class(Security.Applications).Create("/sqlkpi", .cspProperties) | ||
if $$$ISERR(tSC) throw ##class(%Installer.Exception).CreateFromStatus(tSC) | ||
kill cspProperties | ||
} | ||
|
||
do tInstaller.PopNS() | ||
|
||
quit $$$OK | ||
} | ||
|
||
ClassMethod CopyClasses(pVars, pLogLevel, tInstaller) | ||
{ | ||
set sc = $$$OK | ||
|
||
set i = 0 | ||
while 1 { | ||
set id = "SQLKPI.CLSData||File" _ i | ||
if (##class(%Dictionary.CompiledXData).%ExistsId(id) = 0) Q | ||
set class = ##class(%Dictionary.CompiledXData).%OpenId(id) | ||
set data = $zconvert(class.Data.Read(class.Data.Size), "O", "UTF8") | ||
set className = "SQLKPI."_$piece(class.Description,".",1) | ||
|
||
set Namespace = tInstaller.Evaluate("${Namespace}") | ||
do tInstaller.PushNS(Namespace) | ||
|
||
if ('##class(%Dictionary.ClassDefinition).%ExistsId(className)) { | ||
set clsDef = ##class(%Dictionary.ClassDefinition).%New() | ||
set clsDef.Name = className | ||
set sc = clsDef.%Save() | ||
quit:$$$ISERR(sc) | ||
} | ||
set sc = ##class(%Compiler.UDL.TextServices).SetTextFromString(,className,$System.Encryption.Base64Decode(data)) | ||
do $system.OBJ.Compile(className, "cuk") | ||
|
||
do tInstaller.PopNS() | ||
|
||
set i = i + 1 | ||
} | ||
|
||
quit $$$OK | ||
} | ||
|
||
ClassMethod CopyFiles(pVars, pLogLevel, tInstaller) | ||
{ | ||
set csp = tInstaller.Evaluate("${CSPDIR}") | ||
set path = ##class(%File).NormalizeDirectory(csp _ "sqlkpi") | ||
|
||
// Get path separator | ||
set r = ##class(%File).NormalizeDirectory("\") | ||
if ($find(r, "/") = 0) { | ||
set r = "\" | ||
} else { | ||
set r = "/" | ||
} | ||
|
||
set i = 0 | ||
while 1 { | ||
set id = "SQLKPI.CSPData||File" _ i | ||
if (##class(%Dictionary.CompiledXData).%ExistsId(id) = 0) Q | ||
set file = ##class(%Dictionary.CompiledXData).%OpenId(id) | ||
|
||
set data = $zconvert(file.Data.Read(file.Data.Size), "O", "UTF8") | ||
set fileName = ##class(%File).NormalizeFilename(path _ file.Description) | ||
|
||
|
||
set fileName = $replace(fileName, "\", r) | ||
set fileName = $replace(fileName, "/", r) | ||
set dir = ##class(%File).ParentDirectoryName(fileName) | ||
if ('##class(%File).DirectoryExists(dir)) { | ||
do ##class(%File).CreateDirectory(dir) | ||
} | ||
|
||
do tInstaller.Log(pLogLevel, "Creating file", fileName) | ||
|
||
|
||
set f = ##class(%Stream.FileBinary).%New() | ||
do f.LinkToFile(fileName) | ||
do f.Write($System.Encryption.Base64Decode(data)) | ||
do f.%Save() | ||
|
||
set i = i + 1 | ||
} | ||
|
||
quit $$$OK | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
Class SQLKPI.Util | ||
Class SQLKPI.Util [ Abstract ] | ||
{ | ||
|
||
ClassMethod executeSql(query As %String) As %Status | ||
|
Oops, something went wrong.