// =-=-=-=-=-=-=-
// public - resolve a plugin given an interface
    error osauth_auth_object::resolve(
        const std::string& _interface,
        plugin_ptr&        _ptr ) {
        // =-=-=-=-=-=-=-
        // check the interface type and error out if it
        // isnt a auth interface
        if ( AUTH_INTERFACE != _interface ) {
            std::stringstream msg;
            msg << "osauth_auth_object does not support a [";
            msg << _interface;
            msg << "] plugin interface";
            return ERROR( SYS_INVALID_INPUT_PARAM, msg.str() );

        }

        // =-=-=-=-=-=-=-
        // ask the auth manager for a osauth auth plugin
        auth_ptr a_ptr;
        error ret = auth_mgr.resolve(
                        AUTH_OSAUTH_SCHEME,
                        a_ptr );
        if ( !ret.ok() ) {
            // =-=-=-=-=-=-=-
            // attempt to load the plugin, in this case the type,
            // instance name, key etc are all osauth as there is only
            // the need for one instance of a osauth object, etc.
            std::string empty_context( "" );
            ret = auth_mgr.init_from_type(
                      AUTH_OSAUTH_SCHEME,
                      AUTH_OSAUTH_SCHEME,
                      AUTH_OSAUTH_SCHEME,
                      empty_context,
                      a_ptr );
            if ( !ret.ok() ) {
                return PASS( ret );

            }
            else {
                // =-=-=-=-=-=-=-
                // upcast for out variable
                _ptr = boost::dynamic_pointer_cast< plugin_base >( a_ptr );
                return SUCCESS();

            }

        } // if !ok

        // =-=-=-=-=-=-=-
        // upcast for out variable
        _ptr = boost::dynamic_pointer_cast< plugin_base >( a_ptr );

        return SUCCESS();

    } // resolve
Ejemplo n.º 2
0
// =-=-=-=-=-=-=-
// public - resolver for ssl_manager
    error ssl_object::resolve(
        const std::string& _interface,
        plugin_ptr&        _ptr ) {
        // =-=-=-=-=-=-=-
        // check the interface type and error out if it
        // isnt a network interface
        if ( NETWORK_INTERFACE != _interface ) {
            std::stringstream msg;
            msg << "ssl_object does not support a [";
            msg << _interface;
            msg << "] plugin interface";
            return ERROR( SYS_INVALID_INPUT_PARAM, msg.str() );

        }

        // =-=-=-=-=-=-=-
        // ask the network manager for a SSL resource
        network_ptr net_ptr;
        error ret = netwk_mgr.resolve( SSL_NETWORK_PLUGIN, net_ptr );
        if ( !ret.ok() ) {
            // =-=-=-=-=-=-=-
            // attempt to load the plugin, in this case the type,
            // instance name, key etc are all ssl as there is only
            // the need for one instance of a ssl object, etc.
            std::string empty_context( "" );
            ret = netwk_mgr.init_from_type(
                      SSL_NETWORK_PLUGIN,
                      SSL_NETWORK_PLUGIN,
                      SSL_NETWORK_PLUGIN,
                      empty_context,
                      net_ptr );
            if ( !ret.ok() ) {
                return PASS( ret );

            }
            else {
                // =-=-=-=-=-=-=-
                // upcast for out variable
                _ptr = boost::dynamic_pointer_cast< plugin_base >( net_ptr );
                return SUCCESS();

            }

        } // if !ok

        // =-=-=-=-=-=-=-
        // upcast for out variable
        _ptr = boost::dynamic_pointer_cast< plugin_base >( net_ptr );

        return SUCCESS();

    } // resolve
Ejemplo n.º 3
0
// =-=-=-=-=-=-=-
// plugin resolution operation
    error oracle_object::resolve(
        const std::string& _interface,
        plugin_ptr&        _ptr ) {
        // =-=-=-=-=-=-=-
        // check the interface type and error out if it
        // isnt a database interface
        if ( DATABASE_INTERFACE != _interface ) {
            std::stringstream msg;
            msg << "oracle_object does not support a [";
            msg << _interface;
            msg << "] plugin interface";
            return ERROR( SYS_INVALID_INPUT_PARAM, msg.str() );

        }

        // =-=-=-=-=-=-=-
        // ask the database manager for a oracle resource
        database_ptr db_ptr;
        error ret = db_mgr.resolve( ORACLE_DATABASE_PLUGIN, db_ptr );
        if ( !ret.ok() ) {
            // =-=-=-=-=-=-=-
            // attempt to load the plugin, in this case the type,
            // instance name, key etc are all tcp as there is only
            // the need for one instance of a tcp object, etc.
            std::string empty_context( "" );
            ret = db_mgr.init_from_type(
                      ORACLE_DATABASE_PLUGIN,
                      ORACLE_DATABASE_PLUGIN,
                      ORACLE_DATABASE_PLUGIN,
                      empty_context,
                      db_ptr );
            if ( !ret.ok() ) {
                return PASS( ret );

            }
            else {
                // =-=-=-=-=-=-=-
                // upcast for out variable
                _ptr = boost::dynamic_pointer_cast< plugin_base >( db_ptr );
                return SUCCESS();

            }

        } // if !ok

        // =-=-=-=-=-=-=-
        // upcast for out variable
        _ptr = boost::dynamic_pointer_cast< plugin_base >( db_ptr );

        return SUCCESS();

    } // resolve
Ejemplo n.º 4
0
    error gsi_auth_object::resolve(
        const std::string& _interface,
        plugin_ptr& _ptr ) {
        error result = SUCCESS();
        if ( ( result = ASSERT_ERROR( _interface == AUTH_INTERFACE, SYS_INVALID_INPUT_PARAM,
                                      "gsi_auth_object does not support a \"%s\" plugin interface.",
                                      _interface.c_str() ) ).ok() ) {
            auth_ptr ath;
            error ret = auth_mgr.resolve( AUTH_GSI_SCHEME, ath );
            if ( !( result = ASSERT_PASS( ret, "Failed to resolve the GSI auth plugin." ) ).ok() ) {

                // Attempt to load the plugin.
                std::string empty_context( "" );
                ret = auth_mgr.init_from_type( AUTH_GSI_SCHEME, AUTH_GSI_SCHEME, AUTH_GSI_SCHEME, empty_context, ath );
                result = ASSERT_PASS( ret, "Failed to load the GSI auth plugin." );
            }

            if ( result.ok() ) {
                _ptr = boost::dynamic_pointer_cast<plugin_base>( ath );
            }
        }
        return result;
    }