def create_session(user, client_ip, **options):
    '''
    Creates a session and returns it
    '''

    return get_component(APP_SESSION).create_session(user, client_ip,
                                                     **options)
def get_transaction_detail(transaction_id):
    '''
    Returns detail information of the specified transaction.

    @param str transaction_id: transaction ID

    @rtype: dict(str transaction_id: transaction ID
                 datetime start_date: start date of transaction,
                 str user_id: user ID,
                 list(dict) requests: requests regarding to the transaction)
    @type request: dict(str request_id: client request ID,
                        str transaction_id: client request transaction ID,
                        str user_name: client request user name,
                        str client_ip: client request IP,
                        str service_id: client request service ID,
                        datetime receieve_date: client request recieve date,
                        datetime request_date: client request request date,
                        str trace_id: client request trace ID,
                        int state: request state,
                        dict data: data)
    @type data: dict(dict request_header: request header,
                     dict command_args: command args,
                     dict command_kwargs: command kwargs,
                     dict call_context: call context,
                     dict response_data: response data
                     str error: error)
    @type request_header: dict(str recorder_type: recorder type,
                               int version: version)
    @type response_data: dict(datetime send_date: client response send date,
                              dict command_result: client response command result)
    @return: transaction detail
    '''

    return get_component(APP_TRANSACTION_COORDINATOR).get_transaction_detail(
        transaction_id)
Beispiel #3
0
def try_get(recorder_type, request_id, **options):
    '''
    Returns information of a particular request and if the request was not found,
    it would return None.

    @param str recorder_type: recorder type
    @param str request_id: request ID
    
    @rtype: dict(str request_id: client request ID,
                 str transaction_id: client request transaction ID,
                 str user_name: client request user name,
                 str client_ip: client request IP,
                 str service_id: client request service ID,
                 datetime receieve_date: client request recieve date,
                 datetime request_date: client request request date,
                 str trace_id: client request trace ID,
                 int state: request state,
                 dict data: data)
    @type data: dict(dict request_header: request header,
                     dict command_args: command args,
                     dict command_kwargs: command kwargs,
                     dict call_context: call context,
                     dict response_data: response data
                     str error: error)
    @type request_header: dict(str recorder_type: recorder type,
                               int version: version)
    @type response_data: dict(datetime send_date: client response send date,
                              dict command_result: client response command result)
    @return: request info
    '''
    
    return get_component(APP_REQUEST_RECORDER).try_get(recorder_type, request_id, **options)
def set_default_processor(processor_name):
    '''
    Sets given processor as default processor.
    @param processor_name:
    '''
    return get_component(APP_REQUEST_PROCESSOR).set_default_processor(
        processor_name)
def get_sessions_count():
    '''
    Returns count of all sessions.
    
    @return: int
    '''
    return get_component(APP_SESSION).get_sessions_count()
def get_permission(id):
    '''
    Returns specified permission information.
    @param id:
    '''

    return get_component(APP_SECURITY).get_permission(id)
def add_or_update_permission(id, **options):
    '''
    Adds new permission or updates existed permission.
    @param id: permission ID
    '''

    return get_component(APP_SECURITY).add_or_update_permission(id, **options)
def try_get_request(request_id):
    '''
    Returns information of a particular request.

    @param str request_id: request ID

    @rtype: dict(str request_id: client request ID,
                 str transaction_id: client request transaction ID,
                 str user_name: client request user name,
                 str client_ip: client request IP,
                 str service_id: client request service ID,
                 datetime receieve_date: client request recieve date,
                 datetime request_date: client request request date,
                 str trace_id: client request trace ID,
                 int state: request state,
                 dict data: data)
    @type data: dict(dict request_header: request header,
                     dict command_args: command args,
                     dict command_kwargs: command kwargs,
                     dict call_context: call context,
                     dict response_data: response data
                     str error: error)
    @type request_header: dict(str recorder_type: recorder type,
                               int version: version)
    @type response_data: dict(datetime send_date: client response send date,
                              dict command_result: client response command result)
    @return: request info
    '''

    return get_component(APP_TRANSACTION_COORDINATOR).try_get_request(
        request_id)
Beispiel #9
0
def start(process_unit_name, **options):
    '''
    Starts a process unit.
    
    @param process_unit_name: process unit name
    '''

    return get_component(APP_BATCH).start(process_unit_name, **options)
Beispiel #10
0
def truncate_messages(process_unit_name):
    '''
    Truncates message stream.

    @param process_unit_name: process unit name
    '''

    return get_component(APP_BATCH).truncate_messages(process_unit_name)
Beispiel #11
0
def is_completed(process_unit_name):
    '''
    Returns True if the process unit is completed, otherwise False
    
    @param process_unit_name: process unit name
    '''

    return get_component(APP_BATCH).is_completed(process_unit_name)
def get_permissions():
    '''
    Returns all permissions in holder.
    
    @return: [Permission]
    '''

    return get_component(PERMISSION_HOLDER).get_permissions()
def remove_role(code):
    '''
    Removes specified role.
    
    @param code: role code
    '''

    return get_component(APP_SECURITY).remove_role(code)
def set_timeout(timeout):
    '''
    Sets global timeout of request processor.
    
    @param timeout: timeout
    '''

    return get_component(APP_REQUEST_PROCESSOR).set_timeout(timeout)
Beispiel #15
0
def stop(process_unit_name):
    '''
    Stops the process unit.
    
    @param process_unit_name: process unit name
    '''

    return get_component(APP_BATCH).stop(process_unit_name)
def update_permission(id, **params):
    '''
    Updates specified permission using given parameters. 
    @param id: permission ID
    @param **params: 
    '''

    return get_component(APP_SECURITY).update_permission(id, **params)
def remove_permission(id):
    '''
    Removes specified permission.
    
    @param id: permission ID
    '''

    return get_component(APP_SECURITY).remove_permission(id)
def get_roles(**options):
    '''
    Returns roles considering given options.
    
    @return: [DynamicObject<...>]
    '''

    return get_component(APP_SECURITY).get_roles(**options)
def create_internal_user(id, **options):
    '''
    Create an internal user.
    
    @param id: user ID
    '''

    return get_component(APP_SECURITY).create_internal_user(id, **options)
Beispiel #20
0
def join(process_unit_name):
    '''
    Joins to a process unit.
    
    @param process_unit_name: process unit name
    '''

    return get_component(APP_BATCH).join(process_unit_name)
Beispiel #21
0
def join_to_group(name):
    '''
    Joins to a group of process units.
    
    @param name: process units group
    '''

    return get_component(APP_BATCH).join_to_group(name)
def remove_user(id):
    '''
    Removes the given user.
    
    @param id: user name
    '''

    return get_component(APP_SECURITY).remove_user(id)
def logout(logout_request):
    '''
    Logout the user from application.
    
    @param instance logout_request: Raw request received from client.
    '''

    return get_component(APP_REQUEST_PROCESSOR).logout(logout_request)
def terminate(name=None):
    '''
    Starts request processor.

    @param name: processor name 
    '''

    return get_component(APP_REQUEST_PROCESSOR).terminate(name)
Beispiel #25
0
def suspend(process_unit_name):
    '''
    Suspends the process unit.
    
    @param process_unit_name: process unit name
    '''

    return get_component(APP_BATCH).suspend(process_unit_name)
def get_trusted_ips():
    '''
    Returns a list of IPs that can be trusted.
    
    @return: List of trusted IPs.
    @rtype: list(str)
    '''
    return get_component(APP_AUTHENTICATOR).get_trusted_ips()
def get_info():
    '''
    Returns information about active request processor.
    
    @return: DynamicObject
    '''

    return get_component(APP_REQUEST_PROCESSOR).get_info()
Beispiel #28
0
def get_status(process_unit_name):
    '''
    Returns process unit status.
    
    @param process_unit_name: process unit name
    '''

    return get_component(APP_BATCH).get_status(process_unit_name)
Beispiel #29
0
def resume(process_unit_name):
    '''
    Resumes the process unit.
    
    @param process_unit_name: process unit name
    '''

    return get_component(APP_BATCH).resume(process_unit_name)
def hold(permission):
    '''
    Holds the permission.
    
    @param permission: permission instance
    '''

    return get_component(PERMISSION_HOLDER).hold(permission)