CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
cond::XMLAuthenticationService::DataSourceEntry Class Reference

#include <XMLAuthenticationService.h>

Public Member Functions

void appendCredentialItem (const std::string &item, const std::string &value)
 
void appendCredentialItemForRole (const std::string &item, const std::string &value, const std::string &role)
 
const coral::IAuthenticationCredentials & credentials () const
 
const coral::IAuthenticationCredentials & credentials (const std::string &role) const
 
 DataSourceEntry (const std::string &serviceName, const std::string &connectionName)
 Constructor. More...
 
 ~DataSourceEntry ()
 Destructor. More...
 

Private Member Functions

 DataSourceEntry ()=delete
 
 DataSourceEntry (const DataSourceEntry &)=delete
 
DataSourceEntryoperator= (const DataSourceEntry &)=delete
 

Private Attributes

std::string m_connectionName
 The connection name. More...
 
std::map< std::string, coral::AuthenticationCredentials * > m_data
 The structure with the authentication data for the various roles. More...
 
coral::AuthenticationCredentials * m_default
 The input file with the data. More...
 
std::string m_serviceName
 The service name. More...
 

Detailed Description

A simple class holding the roles and the credentials corresponding to a database service

Definition at line 27 of file XMLAuthenticationService.h.

Constructor & Destructor Documentation

◆ DataSourceEntry() [1/3]

cond::XMLAuthenticationService::DataSourceEntry::DataSourceEntry ( const std::string &  serviceName,
const std::string &  connectionName 
)

Constructor.

Definition at line 31 of file XMLAuthenticationService.cc.

34  m_connectionName(connectionName),
35  m_default(new coral::AuthenticationCredentials(serviceName)),
36  m_data() {}

◆ ~DataSourceEntry()

cond::XMLAuthenticationService::DataSourceEntry::~DataSourceEntry ( )

Destructor.

Definition at line 38 of file XMLAuthenticationService.cc.

38  {
39  delete m_default;
40  for (std::map<std::string, coral::AuthenticationCredentials*>::iterator iData = m_data.begin(); iData != m_data.end();
41  ++iData)
42  delete iData->second;
43 }

◆ DataSourceEntry() [2/3]

cond::XMLAuthenticationService::DataSourceEntry::DataSourceEntry ( )
privatedelete

◆ DataSourceEntry() [3/3]

cond::XMLAuthenticationService::DataSourceEntry::DataSourceEntry ( const DataSourceEntry )
privatedelete

Member Function Documentation

◆ appendCredentialItem()

void cond::XMLAuthenticationService::DataSourceEntry::appendCredentialItem ( const std::string &  item,
const std::string &  value 
)

Adds a credential item to the default role.

Definition at line 45 of file XMLAuthenticationService.cc.

46  {
47  m_default->registerItem(item, value);
48 }

References B2GTnPMonitor_cfi::item.

Referenced by cond::XMLAuthenticationService::XMLAuthenticationService::processFile().

◆ appendCredentialItemForRole()

void cond::XMLAuthenticationService::DataSourceEntry::appendCredentialItemForRole ( const std::string &  item,
const std::string &  value,
const std::string &  role 
)

Adds a credential item to the default role.

Definition at line 50 of file XMLAuthenticationService.cc.

52  {
53  std::map<std::string, coral::AuthenticationCredentials*>::iterator iRole = m_data.find(role);
54  if (iRole == m_data.end()) {
55  iRole = m_data.insert(std::make_pair(role, new coral::AuthenticationCredentials(m_serviceName))).first;
56  }
57  iRole->second->registerItem(item, value);
58 }

References B2GTnPMonitor_cfi::item.

Referenced by cond::XMLAuthenticationService::XMLAuthenticationService::processFile().

◆ credentials() [1/2]

const coral::IAuthenticationCredentials & cond::XMLAuthenticationService::DataSourceEntry::credentials ( ) const

Returns a reference to the credentials object for the default role.

Definition at line 60 of file XMLAuthenticationService.cc.

60  {
61  return *m_default;
62 }

◆ credentials() [2/2]

const coral::IAuthenticationCredentials & cond::XMLAuthenticationService::DataSourceEntry::credentials ( const std::string &  role) const

Returns a reference to the credentials object for a given role. If the role is not known to the service an UnknownRoleException is thrown.

std::map< std::string, coral::AuthenticationCredentials* >::const_iterator iRole = m_data.find( role ); if ( iRole == m_data.end() ) throw coral::UnknownRoleException( m_serviceName, m_connectionName, role ); return *( iRole->second );

Definition at line 64 of file XMLAuthenticationService.cc.

65  {
74  return *m_default;
75 }

◆ operator=()

DataSourceEntry& cond::XMLAuthenticationService::DataSourceEntry::operator= ( const DataSourceEntry )
privatedelete

Member Data Documentation

◆ m_connectionName

std::string cond::XMLAuthenticationService::DataSourceEntry::m_connectionName
private

The connection name.

Definition at line 61 of file XMLAuthenticationService.h.

◆ m_data

std::map<std::string, coral::AuthenticationCredentials*> cond::XMLAuthenticationService::DataSourceEntry::m_data
private

The structure with the authentication data for the various roles.

Definition at line 67 of file XMLAuthenticationService.h.

◆ m_default

coral::AuthenticationCredentials* cond::XMLAuthenticationService::DataSourceEntry::m_default
private

The input file with the data.

Definition at line 64 of file XMLAuthenticationService.h.

◆ m_serviceName

std::string cond::XMLAuthenticationService::DataSourceEntry::m_serviceName
private

The service name.

Definition at line 58 of file XMLAuthenticationService.h.

serviceName
static const std::string serviceName
Definition: CredentialStore.cc:31
cond::XMLAuthenticationService::DataSourceEntry::m_connectionName
std::string m_connectionName
The connection name.
Definition: XMLAuthenticationService.h:61
cond::XMLAuthenticationService::DataSourceEntry::m_serviceName
std::string m_serviceName
The service name.
Definition: XMLAuthenticationService.h:58
cond::XMLAuthenticationService::DataSourceEntry::m_data
std::map< std::string, coral::AuthenticationCredentials * > m_data
The structure with the authentication data for the various roles.
Definition: XMLAuthenticationService.h:67
value
Definition: value.py:1
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
cond::XMLAuthenticationService::DataSourceEntry::m_default
coral::AuthenticationCredentials * m_default
The input file with the data.
Definition: XMLAuthenticationService.h:64