Пример #1
0
// =-=-=-=-=-=-=-
// function to load and return an initialized resource plugin
    error load_resource_plugin( resource_ptr&     _plugin,
                                const std::string _plugin_name,
                                const std::string _inst_name,
                                const std::string _context ) {
        // =-=-=-=-=-=-=-
        // resolve plugin directory
        std::string plugin_home;
        error ret = resolve_plugin_path( PLUGIN_TYPE_RESOURCE, plugin_home );
        if ( !ret.ok() ) {
            return PASS( ret );
        }

        resource* resc = 0;
        ret = load_plugin< resource >(
                  resc,
                  _plugin_name,
                  plugin_home,
                  _inst_name,
                  _context );
        if ( ret.ok() && resc ) {
            _plugin.reset( resc );

        }
        else {
            rodsLog(
                LOG_DEBUG,
                "loading impostor resource for [%s] of type [%s] with context [%s]",
                _inst_name.c_str(),
                _plugin_name.c_str(),
                _context.c_str() );
            _plugin.reset(
                new impostor_resource(
                    "impostor_resource", "" ) );

        }

        return SUCCESS();

    } // load_resource_plugin