CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
XMLAuthenticationService.h
Go to the documentation of this file.
1 #ifndef COND_XMLAUTHENTITACTIONSERVICE_H
2 #define COND_XMLAUTHENTITACTIONSERVICE_H
3 
4 #include "RelationalAccess/IAuthenticationService.h"
5 #include "CoralKernel/Service.h"
6 
7 #include <map>
8 #include <set>
9 #include <string>
10 #include <boost/thread.hpp>
11 
12 namespace coral {
13 
14  class AuthenticationCredentials;
15  //class IAuthenticationCredentials;
16 }
17 
18 namespace cond {
19 
21 
28  {
29  public:
32  const std::string& connectionName );
33 
36 
40  void appendCredentialItem( const std::string& item,
41  const std::string& value );
42 
46  void appendCredentialItemForRole( const std::string& item,
47  const std::string& value,
48  const std::string& role );
49 
53  const coral::IAuthenticationCredentials& credentials() const;
54 
59  const coral::IAuthenticationCredentials& credentials( const std::string& role ) const;
60 
61  private:
64 
67 
69  coral::AuthenticationCredentials* m_default;
70 
72  std::map< std::string, coral::AuthenticationCredentials* > m_data;
73 
74  private:
78  };
79 
85  class XMLAuthenticationService : public coral::Service,
86  virtual public coral::IAuthenticationService
87  {
88 
89  public:
91  explicit XMLAuthenticationService( const std::string& name );
92 
94  virtual ~XMLAuthenticationService();
95 
96  public:
101  const coral::IAuthenticationCredentials& credentials( const std::string& connectionString ) const;
102 
108  const coral::IAuthenticationCredentials& credentials( const std::string& connectionString,
109  const std::string& role ) const;
110 
111  public:
113  void setAuthenticationPath( const std::string& inputPath );
114 
115  private:
117  bool initialize();
118 
120  void reset();
121 
123  bool processFile( const std::string& inputFileName );
124 
126  std::set< std::string > verifyFileName();
127 
130 
133 
135  std::map< std::string, DataSourceEntry* > m_data;
136 
139 
140  coral::Property::CallbackID m_callbackID;
141  };
142 
143  }
144 
145 }
146 
147 #endif
std::map< std::string, coral::AuthenticationCredentials * > m_data
The structure with the authentication data for the various roles.
void appendCredentialItemForRole(const std::string &item, const std::string &value, const std::string &role)
bool initialize()
Service framework related initialization.
static boost::mutex mutex
Definition: LHEProxy.cc:11
static const std::string serviceName
DataSourceEntry & operator=(const DataSourceEntry &)
bool m_isInitialized
Flag indicating whether the service has been initialized.
std::set< std::string > verifyFileName()
Verifies the existence of the authentication files.
coral::AuthenticationCredentials * m_default
The input file with the data.
XMLAuthenticationService(const std::string &name)
Standard Constructor.
void setAuthenticationPath(const std::string &inputPath)
Sets the input file name.
string connectionString
Definition: autoCondHLT.py:4
std::map< std::string, DataSourceEntry * > m_data
The structure with the authentication data.
bool processFile(const std::string &inputFileName)
Parses an xml file.
void appendCredentialItem(const std::string &item, const std::string &value)
const coral::IAuthenticationCredentials & credentials() const
std::string m_inputFileName
The input file with the data.
const coral::IAuthenticationCredentials & credentials(const std::string &connectionString) const