xrootd
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
XrdCl::PlugInManager Class Reference

Manage client-side plug-ins and match them agains URLs. More...

#include <XrdClPlugInManager.hh>

Collaboration diagram for XrdCl::PlugInManager:
Collaboration graph
[legend]

Classes

struct  FactoryHelper
 

Public Member Functions

 PlugInManager ()
 Constructor.
 
 ~PlugInManager ()
 Destructor.
 
bool RegisterFactory (const std::string &url, PlugInFactory *factory)
 
bool RegisterDefaultFactory (PlugInFactory *factory)
 
PlugInFactoryGetFactory (const std::string url)
 
void ProcessEnvironmentSettings ()
 

Private Types

typedef void *(* PlugInFunc_t) (const void *arg)
 

Private Member Functions

void ProcessConfigDir (const std::string &dir)
 Process the configuration directory and load plug in definitions.
 
void ProcessPlugInConfig (const std::string &confFile)
 Process a plug-in config file and load the plug-in if possible.
 
std::pair< XrdOucPinLoader *, PlugInFactory * > LoadFactory (const std::string &lib, const std::map< std::string, std::string > &config)
 Load the plug-in and create the factory.
 
bool RegisterFactory (const std::string &urlString, const std::string &lib, PlugInFactory *factory, XrdOucPinLoader *plugin)
 
std::string NormalizeURL (const std::string url)
 Normalize a URL.
 

Private Attributes

std::map< std::string, FactoryHelper * > pFactoryMap
 
FactoryHelperpDefaultFactory
 
XrdSysMutex pMutex
 

Detailed Description

Manage client-side plug-ins and match them agains URLs.

Member Typedef Documentation

◆ PlugInFunc_t

typedef void *(* XrdCl::PlugInManager::PlugInFunc_t) (const void *arg)
private

Constructor & Destructor Documentation

◆ PlugInManager()

XrdCl::PlugInManager::PlugInManager ( )

Constructor.

◆ ~PlugInManager()

XrdCl::PlugInManager::~PlugInManager ( )

Destructor.

Member Function Documentation

◆ GetFactory()

PlugInFactory * XrdCl::PlugInManager::GetFactory ( const std::string  url)

Retrieve the plug-in factory for the given URL

Returns
you do not own the returned memory

◆ LoadFactory()

std::pair< XrdOucPinLoader *, PlugInFactory * > XrdCl::PlugInManager::LoadFactory ( const std::string &  lib,
const std::map< std::string, std::string > &  config 
)
private

Load the plug-in and create the factory.

◆ NormalizeURL()

std::string XrdCl::PlugInManager::NormalizeURL ( const std::string  url)
private

Normalize a URL.

◆ ProcessConfigDir()

void XrdCl::PlugInManager::ProcessConfigDir ( const std::string &  dir)
private

Process the configuration directory and load plug in definitions.

◆ ProcessEnvironmentSettings()

void XrdCl::PlugInManager::ProcessEnvironmentSettings ( )

Process user environment to load plug-in settings.

This will try to load a default plug-in from a library pointed to by the XRD_PLUGIN envvar. If this fails it will scan the configuration files located in:

1) system directory: /etc/xrootd/client.plugins.d/ 2) user direvtory: ~/.xrootd/client.plugins.d/ 3) directory pointed to by XRD_PLUGINCONFDIR envvar

In that order.

The configuration files contain lines with key-value pairs in the form of 'key=value'.

Mandatory keys are: url - a semicolon separated list of URLs the plug-in applies to lib - plugin library to be loaded enabled - determines whether the plug-in should be enabled or not

You may use any other keys for your own purposes.

The config files are processed in alphabetic order, any satteing found later superseeds the previous one. Any setting applied via environment or config files superseeds any setting done programatically.

The plug-in library must implement the following C function:

extern "C"
{
void *XrdClGetPlugIn( const void *arg )
{
return __your_plug_in_factory__;
}
}
void * XrdClGetPlugIn(const void *)

where arg is a const pointer to std::map<std::string, std::string> containing the plug-in configuration.

◆ ProcessPlugInConfig()

void XrdCl::PlugInManager::ProcessPlugInConfig ( const std::string &  confFile)
private

Process a plug-in config file and load the plug-in if possible.

◆ RegisterDefaultFactory()

bool XrdCl::PlugInManager::RegisterDefaultFactory ( PlugInFactory factory)

Register a plug-in factory applying to all URLs, registering a 0 pointer removes the factory

◆ RegisterFactory() [1/2]

bool XrdCl::PlugInManager::RegisterFactory ( const std::string &  url,
PlugInFactory factory 
)

Register a plug-in factory for the given url, registering a 0 pointer removes the factory for the url

◆ RegisterFactory() [2/2]

bool XrdCl::PlugInManager::RegisterFactory ( const std::string &  urlString,
const std::string &  lib,
PlugInFactory factory,
XrdOucPinLoader plugin 
)
private

Register factory, if successful it actuires ownership of the objects

Returns
true if successfully registered

Member Data Documentation

◆ pDefaultFactory

FactoryHelper* XrdCl::PlugInManager::pDefaultFactory
private

◆ pFactoryMap

std::map<std::string, FactoryHelper*> XrdCl::PlugInManager::pFactoryMap
private

◆ pMutex

XrdSysMutex XrdCl::PlugInManager::pMutex
private

The documentation for this class was generated from the following file: