Skip to content

Commit 50a1769

Browse files
conflict merge
2 parents 911f450 + 033b148 commit 50a1769

File tree

5 files changed

+102
-29
lines changed

5 files changed

+102
-29
lines changed

README.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,23 @@ An UML Class explorer for InterSystems Caché.
1515

1616
## Installation
1717

18-
To install Caché UML Explorer, you need to import UMLExplorer package to Caché and then set up a WEB-application.
18+
To install latests Caché UML Explorer, you just need to import UMLExplorer package. Download the
19+
archive from [latest releases](https://github.com/ZitRos/CacheUMLExplorer/releases), and then import
20+
<code>Cache/CacheUMLExplorer-vX.X.X.xml</code> file.
1921

20-
###### Import classes to Caché
21-
To install Caché UML class explorer, download the [latest release](https://github.com/intersystems-ru/UMLExplorer/releases) or build project by yourself. Then import XML file inside <code>Cache</code> directory of archive or directory.
22-
23-
###### Set up WEB application
24-
When you have imported and compiled <b>UMLExplorer package</b> in Caché, make sure the namespace is the same you have imported classes to. Then go to <code>system management portal -> administering -> security -> applications -> web applications</code> and create there a new web application. Fill the <code>name</code> field of it with <code>/UMLExplorer</code> (slash is required) and set the value of <code>dispatch class</code> to <code>UMLExplorer.Router</code>. Click save. Now your WEB application is ready.
25-
26-
###### Use it
27-
Visit <code>[server domain and port]/UMLExplorer/</code> (with slash at end) to enter application.
22+
Note that importing UMLExplorer.WebAppInstaller class will also create a /UMLExplorer application.
23+
If you want to create WEB application manually, please, do not import this class. Anyway, <b>
24+
importing this class requires %SYS permission.</b>
25+
## Usage
26+
Visit <code>[server domain and port]/UMLExplorer/</code> (slash at end required) to enter
27+
application.
2828

2929
## Build
3030

31-
To build project, you need [NodeJS](https://nodejs.org) platform to be installed. Then, clone source code and run <code>npm install</code> from the root of the project. This will install all necessary modules from NPM. Also run <code>npm install -g gulp</code> if you have no gulp builder in your modules.
31+
To build project, you need [NodeJS](https://nodejs.org) platform to be installed. Then, clone source
32+
code and run <code>npm install</code> from the root of the project. This will install all necessary
33+
modules from NPM. Also run <code>npm install -g gulp</code> if you have no gulp builder in your
34+
modules.
3235

33-
After that and each next time just run <code>gulp</code> command from the project root. This will generate <code>build</code> directory, where you will found all what you need.
36+
After that and each next time just run <code>gulp</code> command from the project root. This will
37+
generate <code>build</code> directory, where you will found all what you need.

cache/projectTemplate.xml

Lines changed: 74 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
<Export generator="Cache" version="25" zv="Cache for Windows (x86-64) 2015.2 (Build 540)" ts="2015-04-28 19:50:48">
33
<Class name="UMLExplorer.ClassView">
44
<Description>
5+
Cache UML Explorer vX.X.X/*build.replace:pkg.version*/
56
Class contains methods that return structured classes/packages data.</Description>
6-
<TimeChanged>63686,85630.818189</TimeChanged>
7+
<TimeChanged>63690,48954.853237</TimeChanged>
78
<TimeCreated>63653,67019.989197</TimeCreated>
89

910
<Method name="getClassTree">
@@ -302,11 +303,74 @@ Returns structured package data</Description>
302303
</Class>
303304

304305

305-
<Project name="UMLExplorer" LastModified="2015-05-14 01:35:59.888696">
306+
<Class name="UMLExplorer.WebAppInstaller">
307+
<Super>%Projection.AbstractProjection</Super>
308+
<TimeChanged>63696,65168.289869</TimeChanged>
309+
<TimeCreated>63696,64041.85537</TimeCreated>
310+
311+
<Projection name="Reference">
312+
<Type>WebAppInstaller</Type>
313+
</Projection>
314+
315+
<Method name="CreateProjection">
316+
<Description>
317+
This method is invoked when a class is compiled.</Description>
318+
<ClassMethod>1</ClassMethod>
319+
<FormalSpec><![CDATA[cls:%String,&params]]></FormalSpec>
320+
<ReturnType>%Status</ReturnType>
321+
<Implementation><![CDATA[
322+
set ns = $NAMESPACE
323+
zn:ns'="%SYS" "%SYS"
324+
do ##class(Security.System).GetInstallationSecuritySetting(.security)
325+
if (security="None") {
326+
set cspProperties("AutheEnabled") = 64 // Unauthenticated
327+
} else {
328+
set cspProperties("AutheEnabled") = 32 // Password
329+
}
330+
set cspProperties("NameSpace") = ns
331+
set cspProperties("Description") = "A WEB application for Cache UML Explorer."
332+
set cspProperties("IsNameSpaceDefault") = 1
333+
set cspProperties("DispatchClass") = "UMLExplorer.Router"
334+
if ('##class(Security.Applications).Exists("/UMLExplorer")) {
335+
w !, "Creating WEB application ""/UMLExplorer""..."
336+
set tSC = ##class(Security.Applications).Create("/UMLExplorer", .cspProperties)
337+
if $$$ISERR(tSC) throw ##class(%Installer.Exception).CreateFromStatus(tSC)
338+
w !, "WEB application ""/UMLExplorer"" created."
339+
} else {
340+
w !, "WEB application ""/UMLExplorer"" already exists, so it is ready to use."
341+
}
342+
zn:ns'="%SYS" ns
343+
quit $$$OK
344+
]]></Implementation>
345+
</Method>
346+
347+
<Method name="RemoveProjection">
348+
<Description>
349+
This method is invoked when a class is 'uncompiled'.</Description>
350+
<ClassMethod>1</ClassMethod>
351+
<FormalSpec><![CDATA[cls:%String,&params,recompile:%Boolean]]></FormalSpec>
352+
<ReturnType>%Status</ReturnType>
353+
<Implementation><![CDATA[
354+
set ns = $NAMESPACE
355+
zn:ns'="%SYS" "%SYS"
356+
if (##class(Security.Applications).Exists("/UMLExplorer")) {
357+
w !, "Deleting WEB application ""/UMLExplorer""..."
358+
do ##class(Security.Applications).Delete("/UMLExplorer")
359+
w !, "WEB application ""/UMLExplorer"" was successfully removed."
360+
}
361+
zn:ns'="%SYS" ns
362+
QUIT $$$OK
363+
]]></Implementation>
364+
</Method>
365+
</Class>
366+
367+
368+
<Project name="UMLExplorer" LastModified="2015-05-24 18:07:22.008232">
306369
<Items>
307370
<ProjectItem name="UMLExplorer.ClassView" type="CLS"></ProjectItem>
308371
<ProjectItem name="UMLExplorer.Router" type="CLS"></ProjectItem>
309372
<ProjectItem name="UMLExplorer.StaticContent" type="CLS"></ProjectItem>
373+
<ProjectItem name="UMLExplorer.WebAppInstaller" type="CLS"></ProjectItem>
310374
</Items>
311375
</Project>
312376

@@ -315,7 +379,7 @@ Returns structured package data</Description>
315379
<Description>
316380
REST interface for UMLExplorer</Description>
317381
<Super>%CSP.REST</Super>
318-
<TimeChanged>63685,85586.177035</TimeChanged>
382+
<TimeChanged>63687,39024.811955</TimeChanged>
319383
<TimeCreated>63648,30450.187229</TimeCreated>
320384

321385
<XData name="UrlMap">
@@ -327,9 +391,9 @@ REST interface for UMLExplorer</Description>
327391
<Route Url="/js/CacheUMLExplorer.js" Method="GET" Call="GetJs"/>
328392
<Route Url="/Test" Method="GET" Call="Test"/>
329393
<Route Url="/GetClassTree" Method="GET" Call="GetClassTree"/>
330-
<Route Url="/GetClassView/:ClassName" Method="GET" Call="GetClassView"/>
331-
<Route Url="/GetPackageView/:PackageName" Method="GET" Call="GetPackageView"/>
332-
<Route Url="/GetMethod/:ClassName/:MethodName" Method="GET" Call="GetMethod"/>
394+
<Route Url="/GetClassView" Method="GET" Call="GetClassView"/>
395+
<Route Url="/GetPackageView" Method="GET" Call="GetPackageView"/>
396+
<Route Url="/GetMethod" Method="GET" Call="GetMethod"/>
333397
</Routes>
334398
]]></Data>
335399
</XData>
@@ -349,9 +413,9 @@ Method returns whole class tree visible in the current namespace.</Description>
349413
<Description>
350414
Returns classTree by given class name</Description>
351415
<ClassMethod>1</ClassMethod>
352-
<FormalSpec>className:%String</FormalSpec>
353416
<ReturnType>%Status</ReturnType>
354417
<Implementation><![CDATA[
418+
set className = %request.Get("name")
355419
set classData = ##class(UMLExplorer.ClassView).getClassView(className)
356420
do classData.%ToJSON(, "ou")
357421
return $$$OK
@@ -362,9 +426,9 @@ Returns classTree by given class name</Description>
362426
<Description>
363427
Returns all package class trees by given package name</Description>
364428
<ClassMethod>1</ClassMethod>
365-
<FormalSpec>packageName:%String</FormalSpec>
366429
<ReturnType>%Status</ReturnType>
367430
<Implementation><![CDATA[
431+
set packageName = %request.Get("name")
368432
set classData = ##class(UMLExplorer.ClassView).getPackageView(packageName)
369433
do classData.%ToJSON(, "ou")
370434
return $$$OK
@@ -375,9 +439,10 @@ Returns all package class trees by given package name</Description>
375439
<Description>
376440
Returns method description and code</Description>
377441
<ClassMethod>1</ClassMethod>
378-
<FormalSpec>className:%String,methodName:%String</FormalSpec>
379442
<ReturnType>%Status</ReturnType>
380443
<Implementation><![CDATA[
444+
set className = %request.Get("className")
445+
set methodName = %request.Get("methodName")
381446
set methodData = ##class(ClassView).getMethod(className, methodName)
382447
do methodData.%ToJSON(, "ou")
383448
return $$$OK

gulpfile.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ var banner = [
2828
""
2929
].join("\n");
3030

31+
var specialReplace = function () {
32+
return replace(/[^\s]+\/\*build\.replace:(.*)\*\//g, function (part, match) {
33+
var s = match.toString();
34+
return s.replace(/pkg\.([a-zA-Z]+)/g, function (p,a) { return pkg[a]; });
35+
});
36+
};
37+
3138
gulp.task("clean", function () {
3239
return gulp.src("build", {read: false})
3340
.pipe(clean());
@@ -60,10 +67,7 @@ gulp.task("gatherLibs", ["clean"], function () {
6067
gulp.task("gatherScripts", ["clean", "gatherLibs"], function () {
6168
return gulp.src("web/js/*.js")
6269
.pipe(concat("CacheUMLExplorer.js"))
63-
.pipe(replace(/[^\s]+\/\*build\.replace:(.*)\*\//g, function (part, match) {
64-
var s = match.toString();
65-
return s.replace(/pkg\.([a-zA-Z]+)/g, function (p,a) { return pkg[a]; });
66-
}))
70+
.pipe(specialReplace())
6771
.pipe(wrap("CacheUMLExplorer = (function(){<%= contents %> return CacheUMLExplorer;}());"))
6872
.pipe(uglify({
6973
output: {
@@ -111,7 +115,7 @@ gulp.task("exportCacheXML", [
111115
"clean", "gatherCSS", "gatherScripts", "addHTMLFile", "copyLICENSE", "copyREADME"
112116
], function () {
113117
return gulp.src("cache/projectTemplate.xml")
114-
.pipe(replace(/\{\{replace:HTML}}/, fs.readFileSync("build/web/index.html", "utf-8")))
118+
.pipe(specialReplace())
115119
.pipe(replace(
116120
/\{\{replace:css}}/,
117121
function () { return fs.readFileSync("build/web/css/CacheUMLExplorer.css", "utf-8"); }

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "CacheUMLExplorer",
3-
"version": "0.9.2",
3+
"version": "0.9.4",
44
"description": "An UML Class explorer for InterSystems Caché",
55
"directories": {
66
"test": "test"

web/js/Source.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Source.prototype.getClassTree = function (callback) {
2424
Source.prototype.getMethod = function (className, methodName, callback) {
2525

2626
lib.load(
27-
this.URL + "/GetMethod/" + encodeURIComponent(className) + "/"
27+
this.URL + "/GetMethod?className=" + encodeURIComponent(className) + "&methodName="
2828
+ encodeURIComponent(methodName),
2929
null,
3030
callback);
@@ -38,7 +38,7 @@ Source.prototype.getMethod = function (className, methodName, callback) {
3838
*/
3939
Source.prototype.getClassView = function (className, callback) {
4040

41-
lib.load(this.URL + "/GetClassView/" + encodeURIComponent(className), null, callback);
41+
lib.load(this.URL + "/GetClassView?name=" + encodeURIComponent(className), null, callback);
4242

4343
};
4444

@@ -49,7 +49,7 @@ Source.prototype.getClassView = function (className, callback) {
4949
*/
5050
Source.prototype.getPackageView = function (packageName, callback) {
5151

52-
lib.load(this.URL + "/GetPackageView/" + encodeURIComponent(packageName), null, callback);
52+
lib.load(this.URL + "/GetPackageView?name=" + encodeURIComponent(packageName), null, callback);
5353

5454
};
5555

0 commit comments

Comments
 (0)