Page MenuHomeSealhub

dispatcher-local.js
No OneTemporary

dispatcher-local.js

var ChipManager = require("prometheus-chip-manager");
var Promise = require("bluebird");
var ResourceManager = require("prometheus-resource-manager");
var DatabaseDirectAccess = require("prometheus-database");
var MetadataManager = require("prometheus-metadata-manager");
//var SessionManager = require("prometheus-session-manager");
var UserManager = require("prometheus-user-manager");
var DispatcherLocal = new function(){
//biz (copied) + web (copied)
this.resources_list_by_type = function(type_name, params){
return ResourceManager.list_by_type(type_name, params, this)
}
//biz (copied) + web (copied)
this.resources_create = function(type_name, body){
return ResourceManager.create_resource(type_name, body, this);
}
this.resources_edit_resource_access_mode = function(resource_id, access_mode, access_mode_args){
return ResourceManager.edit_resource_access_mode(resource_id, access_mode, access_mode_args, this);
}
this.resources_delete = function(type_name, body){
return ResourceManager.delete_resource(type_name, body, this);
}
this.resources_get_by_id = function(resource_id){
return ResourceManager.get_resource_by_id(resource_id, this);
}
this.resources_get_access_mode = function(resource_id){
return ResourceManager.get_resource_access_mode(resource_id, this);
}
//biz + web (done)
this.fire_service_action = function(service_name, action_name, payload){
return ChipManager.getService(service_name).fire_action(action_name, payload);
}
//biz (done)
this.database_query = function(){
console.log("database_query arguments:\n", arguments);
return DatabaseDirectAccess.query.apply(DatabaseDirectAccess, arguments);
}
//biz (copied) + web (copied)
this.metadata_increment_variable = function(){
return MetadataManager.increment_variable.apply(MetadataManager, arguments);
}
function call_locally (that, fn){
return function(){
return fn.apply(that, arguments);
}
}
var to_delegate = {
//"session": SessionManager,
"users": UserManager
};
for(var i in to_delegate){
var that = to_delegate[i];
for(var j in that){
this[i+"_"+j]=call_locally(that, that[j]);
}
}
}
module.exports = DispatcherLocal;

File Metadata

Mime Type
text/plain
Expires
Wed, Aug 13, 20:27 (23 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
877040
Default Alt Text
dispatcher-local.js (2 KB)

Event Timeline