<commit_before>
/*jslint node: true */
'use strict';

// ////////////////////////////////////////////////////////////////////////////
//
// system requirements,


var dotenv  = require ( 'dotenv'   ).config(),
    Promise = require ( 'bluebird' ),
    chalk   = require ( 'chalk'    );

    var vm = this || {};

    vm.status = true;

    vm.central_relay = require ( './services/central_relay.js' )( );

    vm.storage_agent = require ( './services/storage_agent.js' )( );
    vm.storage_proxy = require ( './services/storage_proxy.js' )( );

    vm.message_agent = require ( './services/message_agent.js' )( );
    vm.message_proxy = require ( './services/message_proxy.js' )( );

    vm.restapi_agent = require ( './services/restapi_agent.js' )( );
    vm.restapi_proxy = require ( './services/restapi_proxy.js' )( );

    function on_error_during_liftoff ( error )
    {
        if ( true === vm.status )
        {
            vm.status = false;

            vm.reason = error;
        }

        return error;
    }

    vm.central_relay.ctor ( ).then (

        function ( value )
        {
            return vm.storage_agent.ctor ( vm.central_relay );
        },
        function ( error )
        {
            throw on_error_during_liftoff ( error );
        }

    ).then (

        function ( value )
        {
            return vm.storage_proxy.ctor ( vm.central_relay, vm.storage_agent );
        },
        function ( error )
        {
            throw on_error_during_liftoff ( error );
        }

    ).then (

        function ( value )
        {
            return vm.message_agent.ctor ( vm.central_relay, vm.storage_agent );
        },
        function ( error )
        {
            throw on_error_during_liftoff ( error );
        }

    ).then (

        function ( value )
        {
            return vm.message_proxy.ctor ( vm.central_relay, vm.storage_agent, vm.message_agent );
        },
        function ( error )
        {
            throw on_error_during_liftoff ( error );
        }

    ).then (

        function ( value )
        {
            return vm.restapi_agent.ctor ( vm.central_relay, vm.storage_agent );
        },
        function ( error )
        {
            throw on_error_during_liftoff ( error );
        }

    ).then (

        function ( value )
        {
            return vm.restapi_proxy.ctor ( vm.central_relay, vm.storage_agent, vm.restapi_agent );
        },
        function ( error )
        {
            throw on_error_during_liftoff ( error );
        }

    ).catch (

        function ( ex )
        {
            on_error_during_liftoff ( ex );

            console.log ( chalk.red ( 'unable to lift system' ) );
        }

    ).finally (

        function ( )
        {
            if ( true === vm.status )
            {
                console.log ( chalk.green ( 'system online' ) );

            } else
            {
                console.log ( chalk.red ( 'system offline, ', vm.reason ) );
            }
<commit_msg>server_restapi publish for restapi_agent handshake on the line, message_name contract refactoring todo<commit_after>
/*jslint node: true */
'use strict';

// ////////////////////////////////////////////////////////////////////////////
//
// system requirements,


var dotenv  = require ( 'dotenv'   ).config(),
    Promise = require ( 'bluebird' ),
    chalk   = require ( 'chalk'    );

    var vm = this || {};

    vm.status = true;

    vm.central_relay = require ( './services/central_relay.js' )( );

    vm.storage_agent = require ( './services/storage_agent.js' )( );
    vm.storage_proxy = require ( './services/storage_proxy.js' )( );

    vm.message_agent = require ( './services/message_agent.js' )( );
    vm.message_proxy = require ( './services/message_proxy.js' )( );

    vm.restapi_agent = require ( './services/restapi_agent.js' )( );
    vm.restapi_proxy = require ( './services/restapi_proxy.js' )( );

    function on_error_during_liftoff ( error )
    {
        if ( true === vm.status )
        {
            vm.status = false;

            vm.reason = error;
        }

        return error;
    }

    vm.central_relay.ctor ( ).then (

        function ( value )
        {
            return vm.storage_agent.ctor ( vm.central_relay );
        },
        function ( error )
        {
            throw on_error_during_liftoff ( error );
        }

    ).then (

        function ( value )
        {
            return vm.storage_proxy.ctor ( vm.central_relay, vm.storage_agent );
        },
        function ( error )
        {
            throw on_error_during_liftoff ( error );
        }

    ).then (

        function ( value )
        {
            return vm.message_agent.ctor ( vm.central_relay, vm.storage_agent );
        },
        function ( error )
        {
            throw on_error_during_liftoff ( error );
        }

    ).then (

        function ( value )
        {
            return vm.message_proxy.ctor ( vm.central_relay, vm.storage_agent, vm.message_agent );
        },
        function ( error )
        {
            throw on_error_during_liftoff ( error );
        }

    ).then (

        function ( value )
        {
            return vm.restapi_agent.ctor ( vm.central_relay, vm.storage_agent );
        },
        function ( error )
        {
            throw on_error_during_liftoff ( error );
        }

    ).then (

        function ( value )
        {
            return vm.restapi_proxy.ctor ( vm.central_relay, vm.storage_agent, vm.restapi_agent );
        },
        function ( error )
        {
            throw on_error_during_liftoff ( error );
        }

    ).catch (

        function ( ex )
        {
            on_error_during_liftoff ( ex );

            console.log ( chalk.red ( 'unable to lift system' ) );
        }

    ).finally (

        function ( )
        {
            if ( true === vm.status )
            {
                vm.central_relay.publish ( 'restapi_listen', {} );

            } else
            {
                console.log ( chalk.red ( 'system offline, shutting down', vm.reason ) );

                process.exit ( 0 );
            }

{'fraction_non_alphanumeric': 0.1418578168212136, 'fraction_numerical': 0.00016268098259313488, 'mean_word_length': 1.4090909090909092, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2751613', 'n_tokens_mistral': 1861, 'n_tokens_neox': 1754, 'n_words': 327}