xrootd
Loading...
Searching...
No Matches
XrdClPlugInManager.hh
Go to the documentation of this file.
1//------------------------------------------------------------------------------
2// Copyright (c) 2014 by European Organization for Nuclear Research (CERN)
3// Author: Lukasz Janyst <ljanyst@cern.ch>
4//------------------------------------------------------------------------------
5// This file is part of the XRootD software suite.
6//
7// XRootD is free software: you can redistribute it and/or modify
8// it under the terms of the GNU Lesser General Public License as published by
9// the Free Software Foundation, either version 3 of the License, or
10// (at your option) any later version.
11//
12// XRootD is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU Lesser General Public License
18// along with XRootD. If not, see <http://www.gnu.org/licenses/>.
19//
20// In applying this licence, CERN does not waive the privileges and immunities
21// granted to it by virtue of its status as an Intergovernmental Organization
22// or submit itself to any jurisdiction.
23//------------------------------------------------------------------------------
24
25#ifndef __XRD_CL_PLUGIN_MANAGER__
26#define __XRD_CL_PLUGIN_MANAGER__
27
31
32#include <map>
33#include <string>
34#include <utility>
35
36namespace XrdCl
37{
38 //----------------------------------------------------------------------------
40 //----------------------------------------------------------------------------
42 {
43 public:
44 //------------------------------------------------------------------------
46 //------------------------------------------------------------------------
48
49 //------------------------------------------------------------------------
51 //------------------------------------------------------------------------
53
54 //------------------------------------------------------------------------
57 //------------------------------------------------------------------------
58 bool RegisterFactory( const std::string &url,
59 PlugInFactory *factory );
60
61 //------------------------------------------------------------------------
64 //------------------------------------------------------------------------
66
67 //------------------------------------------------------------------------
71 //------------------------------------------------------------------------
72 PlugInFactory *GetFactory( const std::string url );
73
74 //------------------------------------------------------------------------
116 //------------------------------------------------------------------------
118
119 private:
120 typedef void *(*PlugInFunc_t)( const void *arg );
121
123 {
124 FactoryHelper(): plugin(0), factory(0), isEnv(false), counter(0) {}
126 {
127 delete factory;
128 if(plugin) plugin->Unload();
129 delete plugin;
130 }
133 bool isEnv;
134 uint32_t counter;
135 };
136
137 //------------------------------------------------------------------------
139 //------------------------------------------------------------------------
140 void ProcessConfigDir( const std::string &dir );
141
142 //------------------------------------------------------------------------
144 //------------------------------------------------------------------------
145 void ProcessPlugInConfig( const std::string &confFile );
146
147 //------------------------------------------------------------------------
149 //------------------------------------------------------------------------
150 std::pair<XrdOucPinLoader*,PlugInFactory*> LoadFactory(
151 const std::string &lib,
152 const std::map<std::string, std::string> &config );
153
154 //------------------------------------------------------------------------
157 //------------------------------------------------------------------------
158 bool RegisterFactory( const std::string &urlString,
159 const std::string &lib,
160 PlugInFactory *factory,
161 XrdOucPinLoader *plugin );
162
163 //------------------------------------------------------------------------
165 //------------------------------------------------------------------------
166 std::string NormalizeURL( const std::string url );
167
168 std::map<std::string, FactoryHelper*> pFactoryMap;
171 };
172}
173
174#endif // __XRD_CL_PLUGIN_MANAGER__
Plugin factory.
Definition XrdClPlugInInterface.hh:549
Manage client-side plug-ins and match them agains URLs.
Definition XrdClPlugInManager.hh:42
void ProcessEnvironmentSettings()
bool RegisterFactory(const std::string &url, PlugInFactory *factory)
std::string NormalizeURL(const std::string url)
Normalize a URL.
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.
void ProcessConfigDir(const std::string &dir)
Process the configuration directory and load plug in definitions.
PlugInManager()
Constructor.
bool RegisterDefaultFactory(PlugInFactory *factory)
void ProcessPlugInConfig(const std::string &confFile)
Process a plug-in config file and load the plug-in if possible.
std::map< std::string, FactoryHelper * > pFactoryMap
Definition XrdClPlugInManager.hh:168
XrdSysMutex pMutex
Definition XrdClPlugInManager.hh:170
~PlugInManager()
Destructor.
FactoryHelper * pDefaultFactory
Definition XrdClPlugInManager.hh:169
PlugInFactory * GetFactory(const std::string url)
bool RegisterFactory(const std::string &urlString, const std::string &lib, PlugInFactory *factory, XrdOucPinLoader *plugin)
Definition XrdOucPinLoader.hh:50
void Unload(bool dodel=false)
Definition XrdSysPthread.hh:165
Definition XrdClAction.hh:34
Definition XrdClPlugInManager.hh:123
FactoryHelper()
Definition XrdClPlugInManager.hh:124
XrdOucPinLoader * plugin
Definition XrdClPlugInManager.hh:131
uint32_t counter
Definition XrdClPlugInManager.hh:134
PlugInFactory * factory
Definition XrdClPlugInManager.hh:132
bool isEnv
Definition XrdClPlugInManager.hh:133
~FactoryHelper()
Definition XrdClPlugInManager.hh:125