CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
 DataSourceEntry (const DataSourceEntry &)
 
DataSourceEntryoperator= (const DataSourceEntry &)
 

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

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

Constructor.

Definition at line 31 of file XMLAuthenticationService.cc.

32  :
33  m_serviceName( serviceName ),
34  m_connectionName( connectionName ),
35  m_default( new coral::AuthenticationCredentials( serviceName ) ),
36  m_data()
37 {}
std::map< std::string, coral::AuthenticationCredentials * > m_data
The structure with the authentication data for the various roles.
coral::AuthenticationCredentials * m_default
The input file with the data.
cond::XMLAuthenticationService::DataSourceEntry::~DataSourceEntry ( )

Destructor.

Definition at line 39 of file XMLAuthenticationService.cc.

40 {
41  delete m_default;
42  for ( std::map< std::string, coral::AuthenticationCredentials* >::iterator iData = m_data.begin();
43  iData != m_data.end(); ++iData )
44  delete iData->second;
45 }
std::map< std::string, coral::AuthenticationCredentials * > m_data
The structure with the authentication data for the various roles.
coral::AuthenticationCredentials * m_default
The input file with the data.
cond::XMLAuthenticationService::DataSourceEntry::DataSourceEntry ( )
private
cond::XMLAuthenticationService::DataSourceEntry::DataSourceEntry ( const DataSourceEntry )
private

Member Function Documentation

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

Adds a credential item to the default role.

Definition at line 48 of file XMLAuthenticationService.cc.

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

50 {
51  m_default->registerItem( item, value );
52 }
coral::AuthenticationCredentials * m_default
The input file with the data.
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 55 of file XMLAuthenticationService.cc.

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

58 {
59  std::map< std::string, coral::AuthenticationCredentials* >::iterator iRole = m_data.find( role );
60  if ( iRole == m_data.end() ) {
61  iRole = m_data.insert( std::make_pair( role, new coral::AuthenticationCredentials( m_serviceName ) ) ).first;
62  }
63  iRole->second->registerItem( item, value );
64 }
std::map< std::string, coral::AuthenticationCredentials * > m_data
The structure with the authentication data for the various roles.
const coral::IAuthenticationCredentials & cond::XMLAuthenticationService::DataSourceEntry::credentials ( ) const

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

Definition at line 67 of file XMLAuthenticationService.cc.

68 {
69  return *m_default;
70 }
coral::AuthenticationCredentials * m_default
The input file with the data.
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.

Definition at line 73 of file XMLAuthenticationService.cc.

74 {
75  std::map< std::string, coral::AuthenticationCredentials* >::const_iterator iRole = m_data.find( role );
76  if ( iRole == m_data.end() )
77  throw coral::UnknownRoleException( m_serviceName,
79  role );
80  return *( iRole->second );
81 }
std::map< std::string, coral::AuthenticationCredentials * > m_data
The structure with the authentication data for the various roles.
DataSourceEntry& cond::XMLAuthenticationService::DataSourceEntry::operator= ( const DataSourceEntry )
private

Member Data Documentation

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

The connection name.

Definition at line 66 of file XMLAuthenticationService.h.

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 72 of file XMLAuthenticationService.h.

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

The input file with the data.

Definition at line 69 of file XMLAuthenticationService.h.

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

The service name.

Definition at line 63 of file XMLAuthenticationService.h.