XRootD
XrdClRecorderPlugin.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // Copyright (c) 2011-2017 by European Organization for Nuclear Research (CERN)
3 // Author: Michal Simon <michal.simon@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 #ifndef SRC_XRDAPPS_RECORDPLUGIN_RECORDERPLUGIN_HH_
25 #define SRC_XRDAPPS_RECORDPLUGIN_RECORDERPLUGIN_HH_
26 
28 
29 namespace XrdCl
30 {
31 //------------------------------------------------------------------------------
33 //------------------------------------------------------------------------------
35 {
36  public:
37  //----------------------------------------------------------------------------
41  //----------------------------------------------------------------------------
42  RecorderFactory( const std::map<std::string, std::string>* config )
43  {
44  if( config )
45  {
46  auto itr = config->find( "output" );
47  Recorder::SetOutput( itr != config->end() ? itr->second : "" );
48  }
49  }
50 
51  //----------------------------------------------------------------------------
53  //----------------------------------------------------------------------------
54  virtual ~RecorderFactory()
55  {
56  }
57 
58  //----------------------------------------------------------------------------
60  //----------------------------------------------------------------------------
61  virtual FilePlugIn* CreateFile(const std::string& url)
62  {
63  std::unique_ptr<Recorder> ptr( new Recorder() );
64  if( !ptr->IsValid() )
65  return nullptr;
66  return static_cast<FilePlugIn*>( ptr.release() );
67  }
68 
69  //----------------------------------------------------------------------------
71  //----------------------------------------------------------------------------
72  virtual FileSystemPlugIn* CreateFileSystem(const std::string& url)
73  {
74  Log* log = DefaultEnv::GetLog();
75  log->Error(1, "FileSystem plugin implementation not supported");
76  return static_cast<FileSystemPlugIn*>(0);
77  }
78 };
79 
80 } // namespace xrdcl_proxy
81 
82 #endif
static Log * GetLog()
Get default log.
An interface for file plug-ins.
An interface for file plug-ins.
Handle diagnostics.
Definition: XrdClLog.hh:101
void Error(uint64_t topic, const char *format,...)
Report an error.
Definition: XrdClLog.cc:231
XrdCl recorder plug-in factory.
RecorderFactory(const std::map< std::string, std::string > *config)
virtual FilePlugIn * CreateFile(const std::string &url)
Create a file plug-in for the given URL.
virtual FileSystemPlugIn * CreateFileSystem(const std::string &url)
Create a file system plug-in for the given URL.
virtual ~RecorderFactory()
Destructor.
static void SetOutput(const std::string &cfgpath)