2002-09-23 12:22:13 +00:00
|
|
|
/**
|
2005-08-31 13:16:21 +00:00
|
|
|
* renders the api of a given application. used from commandline.
|
|
|
|
*/
|
2004-01-06 15:55:39 +00:00
|
|
|
function renderApi(appName) {
|
|
|
|
|
|
|
|
// supress security checks when accessing actions
|
|
|
|
res.data.noWeb = true;
|
|
|
|
|
|
|
|
// start the application
|
|
|
|
this.startApplication(appName);
|
|
|
|
var appObj = this.getApp(appName);
|
|
|
|
var docApp = appObj.getChildElement("api");
|
|
|
|
|
|
|
|
// now render the api
|
|
|
|
var ct = docApp.renderApi();
|
|
|
|
writeln("rendered " + ct + " files");
|
2005-08-31 13:16:21 +00:00
|
|
|
|
2004-01-06 15:55:39 +00:00
|
|
|
// cleanup
|
|
|
|
this.stopApplication(appName);
|
2002-09-23 12:22:13 +00:00
|
|
|
}
|
|
|
|
|
2004-01-06 15:55:39 +00:00
|
|
|
|
2002-03-11 13:49:50 +00:00
|
|
|
/**
|
|
|
|
* lists all applications in appdir.
|
|
|
|
* for active apps use this.getApplications() = helma.main.Server.getApplications()
|
|
|
|
*/
|
2005-08-31 13:16:21 +00:00
|
|
|
function getAllApplications() {
|
|
|
|
var appsDir = this.getAppsHome();
|
|
|
|
var dir = appsDir.list();
|
|
|
|
var arr = new Array();
|
|
|
|
for (var i = 0; i < dir.length; i++) {
|
|
|
|
if (dir[i].toLowerCase() != "cvs" && dir[i].indexOf(".") == -1)
|
|
|
|
arr[arr.length] = this.getApp(dir[i]);
|
|
|
|
}
|
|
|
|
return arr;
|
2002-03-11 13:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get application by name, constructs an hopobject of the prototype application
|
|
|
|
* if the app is not running (and therefore can't be access through
|
|
|
|
* helma.main.ApplicationManager).
|
|
|
|
* ATTENTION: javascript should not overwrite helma.main.Server.getApplication() which
|
|
|
|
* retrieves active applications.
|
|
|
|
* @arg name of application
|
|
|
|
*/
|
2005-08-31 13:16:21 +00:00
|
|
|
function getApp(name) {
|
|
|
|
if (name == null || name == "")
|
|
|
|
return null;
|
|
|
|
var appObj = this.getApplication(name);
|
|
|
|
if (appObj == null)
|
|
|
|
appObj = new Application(name);
|
|
|
|
return appObj;
|
2002-03-11 13:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|