Ejemplo n.º 1
0
def get_hooks():
    '''
    Returns all execution hooks.
    
    @return: list<CommandExecutionHook>
    '''
    return get_app_context()[APP_COMMANDER].get_hooks()
Ejemplo n.º 2
0
def get_commands(parent=None,
                 name_filter=None,
                 description_filter=None,
                 exact_name=None):
    '''
    Returns all commands.
    If any filter specified, it filter those commands.

    @keyword str parent: only return commands that their parrents
        matches this string.
    @keyword str name_filter: only return commands that their names
        contain this string.
    @keyword str exact_name: only return command that its name
        is this string.
    @keyword str description_filter: only return commands that their
        description contain this string.

    @return: founded commands
    @rtype: list(dict(str name,
                      str description))
    '''
    return get_app_context()[APP_COMMANDER].get_commands(parent=parent,
                                                         name_filter=name_filter,
                                                         description_filter=description_filter,
                                                         exact_name=exact_name)
Ejemplo n.º 3
0
def set_executor(executor):
    '''
    Registers a executor by the given name
    
    @param executor: executor instance
    '''
    return get_app_context()[APP_COMMANDER].set_executor(executor)
Ejemplo n.º 4
0
def add_hook(hook):
    '''
    Adds a execution hook to the commander.
    
    @param hook:
    '''
    return get_app_context()[APP_COMMANDER].add_hook(hook)
Ejemplo n.º 5
0
def remove_command(command):
    '''
    Removes the given command.
    
    @param command:
    '''
    return get_app_context()[APP_COMMANDER].remove_command(command)
Ejemplo n.º 6
0
def remove_commands(parent):
    '''
    Removes all commands in the given parent domain.
    
    @param parent: parent name
    '''
    return get_app_context()[APP_COMMANDER].remove_commands(parent)
Ejemplo n.º 7
0
def register_cache_type(name, cache_type):
    '''
    Registers a cache type using specified name.
    @param name: registration name.
    @param type: class type.
    '''
    return get_app_context()[APP_CACHING].register_cache_type(name, cache_type)
Ejemplo n.º 8
0
def exists(name):
    '''
    Returns True if cache exists in cache manager.

    @return: bool
    '''

    return get_app_context()[APP_CACHING].exists(name)
Ejemplo n.º 9
0
def execute(key, *args, **kargs):
    '''
    Executes a command by given key.
    
    @param key: command key or command name
    @return: object
    '''
    return get_app_context()[APP_COMMANDER].execute(key, *args, **kargs)
Ejemplo n.º 10
0
def get_command(key):
    '''
    Returns the command by the given key.
    
    @param key: command key
    @return: command
    '''
    return get_app_context()[APP_COMMANDER].get_command(key)
Ejemplo n.º 11
0
def add_command(command, **options):
    '''
    Adds a command.
    
    @param command: command instance
    '''
    
    return get_app_context()[APP_COMMANDER].add_command(command, 
                                                        **options)
Ejemplo n.º 12
0
def get_cache(name, cache_type_name = None, **cache_params):
    '''
    Returns the cache by given name. If the cache does not exists,
    This function creates a new cache by the given name and returns it.
    
    @param name: cache name.
    @param cache_type_name: type of cache.
    @param **cache_params: required parameters of specified cache type.  
    @return: Cache        
    '''          
    return get_app_context()[APP_CACHING].get_cache(name, cache_type_name, **cache_params)
Ejemplo n.º 13
0
def execute_async(key, callback, *args, **kargs):
    '''
    Executes a command by given key.
    
    @param key: command key or command name
    @param callback: callback function
    @return: None 
    '''
    return get_app_context()[APP_COMMANDER].execute_async(key, 
                                                          callback, 
                                                          *args, 
                                                          **kargs)
Ejemplo n.º 14
0
def bulk_execute(commands, **options):
    '''
    Executes a command by given key.
    
    @param commands: command data list as dict<command_key, args, kwargs>:
        command_key: command key
        args: command arguments
        kwargs: command keyword arguments
    @param **options: 
    @return: object
    '''
    
    return get_app_context()[APP_COMMANDER].bulk_execute(commands, **options)
Ejemplo n.º 15
0
def select(fields, command_key, *args, **kwargs): 
    '''
    Executes a command and returns requested fields. 
    
    @param fields: list of requested fields 
    @param command_key: command key
    @param *args:
    @param **kwargs:
    
    @return: [DynamicObject<fields>]  
    '''
    
    return get_app_context()[APP_COMMANDER].select(fields, command_key, *args, **kwargs)
Ejemplo n.º 16
0
def add_hook(hook):
    return get_app_context()[APP_COMMUNICATOR].add_hook(hook)
Ejemplo n.º 17
0
def create_proxy_by_ticket(ticket, user_name, **kwargs):
    return get_app_context()[APP_COMMUNICATOR].create_proxy_by_ticket(
        ticket, user_name, **kwargs)
Ejemplo n.º 18
0
def create_proxy(user_name, password, **kwargs):
    return get_app_context()[APP_COMMUNICATOR].create_proxy(
        user_name, password, **kwargs)
Ejemplo n.º 19
0
def start(config_store=None):
    return get_app_context()[APP_COMMUNICATOR].start(config_store)
Ejemplo n.º 20
0
def stop(force=False):
    return get_app_context()[APP_COMMUNICATOR].stop(force)
Ejemplo n.º 21
0
def get_listener_params(name):
    return get_app_context()[APP_COMMUNICATOR].get_listener_params(name)
Ejemplo n.º 22
0
def get_listeners():
    return get_app_context()[APP_COMMUNICATOR].get_listeners()
Ejemplo n.º 23
0
def drop_cache(name):
    return get_app_context()[APP_CACHING].drop_cache(name)
Ejemplo n.º 24
0
def get_caches():
    return get_app_context()[APP_CACHING].get_caches()
Ejemplo n.º 25
0
def get_executer():
    '''
    Returns defult executor.
    '''
    return get_app_context()[APP_COMMANDER].get_executer()
Ejemplo n.º 26
0
def get_hooks():
    return get_app_context()[APP_COMMUNICATOR].get_hooks()
Ejemplo n.º 27
0
def reset_cache(name):
    return get_app_context()[APP_CACHING].reset_cache(name)
Ejemplo n.º 28
0
def register_factory(type_name, factory):
    return get_app_context()[APP_COMMUNICATOR].register_factory(
        type_name, factory)
Ejemplo n.º 29
0
def add_cache(cache, replace = False):
    return get_app_context()[APP_CACHING].add_cache(cache, replace)