TAO::SL3::CredentialsCurator Class Reference

Implementation of the SecurityLevel3::CredentialsCurator object. More...

#include <SL3_CredentialsCurator.h>

Inheritance diagram for TAO::SL3::CredentialsCurator:

Inheritance graph
[legend]
Collaboration diagram for TAO::SL3::CredentialsCurator:

Collaboration graph
[legend]
List of all members.

Public Types

typedef CredentialsCurator_ptr _ptr_type
typedef CredentialsCurator_var _var_type
typedef CredentialsCurator_out _out_type
typedef ACE_Map_Manager< const
char *, TAO::SL3::CredentialsAcquirerFactory *,
ACE_Null_Mutex
Acquirer_Factory_Table
typedef Acquirer_Factory_Table::iterator Factory_Iterator
typedef ACE_Hash_Map_Manager_Ex<
const char *, SecurityLevel3::OwnCredentials_var,
ACE_Hash< const char * >,
ACE_Equal_To< const char * >,
ACE_Null_Mutex
Credentials_Table
typedef Credentials_Table::iterator Credentials_Iterator

Public Member Functions

 CredentialsCurator (void)
 Constructor.

void register_acquirer_factory (const char *acquisition_method, TAO::SL3::CredentialsAcquirerFactory *factory)
 Register CredentialsAcquirer factory.

void _tao_add_own_credentials (SecurityLevel3::OwnCredentials_ptr credentials)
SecurityLevel3::CredentialsCurator Methods
Methods required by the SecurityLevel3::CredentialsCurator interface.

virtual SecurityLevel3::AcquisitionMethodList * supported_methods ()
virtual SecurityLevel3::CredentialsAcquirer_ptr acquire_credentials (const char *acquisition_method, const CORBA::Any &acquisition_arguments)
virtual SecurityLevel3::OwnCredentialsList * default_creds_list ()
virtual SecurityLevel3::CredentialsIdList * default_creds_ids ()
virtual SecurityLevel3::OwnCredentials_ptr get_own_credentials (const char *credentials_id)
virtual void release_own_credentials (const char *credentials_id)

Static Public Member Functions

CredentialsCurator_ptr _duplicate (CredentialsCurator_ptr obj)
CredentialsCurator_ptr _nil (void)
CredentialsCurator_ptr _narrow (CORBA::Object_ptr obj)

Protected Member Functions

 ~CredentialsCurator (void)
 Destructor.


Private Attributes

TAO_SYNCH_MUTEX lock_
 Lock used to synchronize access to underlying tables.

Acquirer_Factory_Table acquirer_factories_
 Table of CredentialsAcquirer factories.

Credentials_Table credentials_table_
 Table of OwnCredentials.


Detailed Description

Implementation of the SecurityLevel3::CredentialsCurator object.

This class provides a means for creating and managing OwnCredentials.

Definition at line 60 of file SL3_CredentialsCurator.h.


Member Typedef Documentation

typedef CredentialsCurator_out TAO::SL3::CredentialsCurator::_out_type
 

Reimplemented from CORBA::LocalObject.

Definition at line 67 of file SL3_CredentialsCurator.h.

typedef CredentialsCurator_ptr TAO::SL3::CredentialsCurator::_ptr_type
 

Reimplemented from CORBA::LocalObject.

Definition at line 65 of file SL3_CredentialsCurator.h.

typedef CredentialsCurator_var TAO::SL3::CredentialsCurator::_var_type
 

Reimplemented from CORBA::LocalObject.

Definition at line 66 of file SL3_CredentialsCurator.h.

typedef ACE_Map_Manager<const char *, TAO::SL3::CredentialsAcquirerFactory *, ACE_Null_Mutex> TAO::SL3::CredentialsCurator::Acquirer_Factory_Table
 

The type of table that maps acquisition method to acquirer factory.

Definition at line 75 of file SL3_CredentialsCurator.h.

typedef Credentials_Table::iterator TAO::SL3::CredentialsCurator::Credentials_Iterator
 

Definition at line 83 of file SL3_CredentialsCurator.h.

Referenced by default_creds_ids(), default_creds_list(), and ~CredentialsCurator().

typedef ACE_Hash_Map_Manager_Ex<const char *, SecurityLevel3::OwnCredentials_var, ACE_Hash<const char *>, ACE_Equal_To<const char *>, ACE_Null_Mutex> TAO::SL3::CredentialsCurator::Credentials_Table
 

Definition at line 82 of file SL3_CredentialsCurator.h.

typedef Acquirer_Factory_Table::iterator TAO::SL3::CredentialsCurator::Factory_Iterator
 

Definition at line 76 of file SL3_CredentialsCurator.h.

Referenced by supported_methods(), and ~CredentialsCurator().


Constructor & Destructor Documentation

TAO::SL3::CredentialsCurator::CredentialsCurator void   ) 
 

Constructor.

Definition at line 21 of file SL3_CredentialsCurator.cpp.

00022   : lock_ (),
00023     acquirer_factories_ (),
00024     credentials_table_ (TAO::SL3::CREDENTIALS_TABLE_SIZE)
00025 {
00026 }

TAO::SL3::CredentialsCurator::~CredentialsCurator void   )  [protected]
 

Destructor.

Protected destructor to enforce proper memory management through the reference counting mechanism.

Definition at line 28 of file SL3_CredentialsCurator.cpp.

References acquirer_factories_, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::begin(), ACE_Map_Manager< EXT_ID, INT_ID, ACE_LOCK >::begin(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::close(), ACE_Map_Manager< EXT_ID, INT_ID, ACE_LOCK >::close(), Credentials_Iterator, credentials_table_, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::end(), ACE_Map_Manager< EXT_ID, INT_ID, ACE_LOCK >::end(), Factory_Iterator, and CORBA::string_free().

00029 {
00030   const Factory_Iterator fend = this->acquirer_factories_.end ();
00031   for (Factory_Iterator i = this->acquirer_factories_.begin ();
00032        i != fend;
00033        ++i)
00034     {
00035       // Deallocate the Acquistion Method.
00036       CORBA::string_free (const_cast<char *> ((*i).ext_id_));
00037 
00038       delete (*i).int_id_;
00039     }
00040 
00041   this->acquirer_factories_.close ();
00042 
00043   const Credentials_Iterator end = this->credentials_table_.end ();
00044   for (Credentials_Iterator j = this->credentials_table_.begin ();
00045        j != end;
00046        ++j)
00047     {
00048       // Deallocate the CredentialsId.
00049       CORBA::string_free (const_cast<char *> ((*j).ext_id_));
00050     }
00051 
00052   this->credentials_table_.close ();
00053 }


Member Function Documentation

TAO::SL3::CredentialsCurator_ptr TAO::SL3::CredentialsCurator::_duplicate CredentialsCurator_ptr  obj  )  [static]
 

Definition at line 56 of file SL3_CredentialsCurator.cpp.

References TAO_Local_RefCounted_Object::_add_ref(), TAO::SL3::CredentialsCurator_ptr, and CORBA::is_nil().

Referenced by _narrow().

00057 {
00058   if (!CORBA::is_nil (obj))
00059     obj->_add_ref ();
00060 
00061   return obj;
00062 }

TAO::SL3::CredentialsCurator_ptr TAO::SL3::CredentialsCurator::_narrow CORBA::Object_ptr  obj  )  [static]
 

Reimplemented from CORBA::LocalObject.

Definition at line 65 of file SL3_CredentialsCurator.cpp.

References _duplicate().

00066 {
00067   return TAO::SL3::CredentialsCurator::_duplicate (
00068              dynamic_cast<TAO::SL3::CredentialsCurator *> (obj));
00069 }

TAO::SL3::CredentialsCurator_ptr TAO::SL3::CredentialsCurator::_nil void   )  [static]
 

Reimplemented from CORBA::LocalObject.

Definition at line 72 of file SL3_CredentialsCurator.cpp.

00073 {
00074   return (CredentialsCurator *) 0;
00075 }

void TAO::SL3::CredentialsCurator::_tao_add_own_credentials SecurityLevel3::OwnCredentials_ptr  credentials  ) 
 

TAO-specific means of adding credentials to this CredentialsCurator's "own credentials" list.

Definition at line 249 of file SL3_CredentialsCurator.cpp.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind(), and credentials_table_.

00251 {
00252   CORBA::String_var credentials_id =
00253     credentials->creds_id ();
00254 
00255   SecurityLevel3::OwnCredentials_var creds =
00256     SecurityLevel3::OwnCredentials::_duplicate (credentials);
00257 
00258   if (this->credentials_table_.bind (credentials_id.in (),
00259                                      creds) != 0)
00260     {
00261       throw CORBA::NO_RESOURCES ();
00262     }
00263 
00264  // CredentialsCurator nows owns the id.
00265   (void) credentials_id._retn ();
00266 }

SecurityLevel3::CredentialsAcquirer_ptr TAO::SL3::CredentialsCurator::acquire_credentials const char *  acquisition_method,
const CORBA::Any &  acquisition_arguments
[virtual]
 

Definition at line 107 of file SL3_CredentialsCurator.cpp.

References acquirer_factories_, ACE_Map_Manager< EXT_ID, INT_ID, ACE_LOCK >::find(), and TAO::SL3::CredentialsAcquirerFactory::make().

00110 {
00111   TAO::SL3::CredentialsAcquirerFactory * factory;
00112 
00113   if (this->acquirer_factories_.find (acquisition_method,
00114                                       factory) == 0)
00115     {
00116       return factory->make (this,
00117                             acquisition_arguments);
00118     }
00119 
00120   throw CORBA::BAD_PARAM ();
00121 
00122 }

SecurityLevel3::CredentialsIdList * TAO::SL3::CredentialsCurator::default_creds_ids  )  [virtual]
 

Definition at line 156 of file SL3_CredentialsCurator.cpp.

References ACE_GUARD_RETURN, ACE_NEW_THROW_EX, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::begin(), Credentials_Iterator, credentials_table_, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::end(), CORBA::string_dup(), and TAO_SYNCH_MUTEX.

00157 {
00158   SecurityLevel3::CredentialsIdList * list;
00159   ACE_NEW_THROW_EX (list,
00160                     SecurityLevel3::CredentialsIdList,
00161                     CORBA::NO_MEMORY ());
00162   SecurityLevel3::CredentialsIdList_var creds_ids = list;
00163 
00164   ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
00165                     guard,
00166                     this->lock_,
00167                     0);
00168 
00169   creds_ids->length (this->credentials_table_.current_size ());
00170 
00171   CORBA::ULong n = 0;
00172 
00173   const Credentials_Iterator end = this->credentials_table_.end ();
00174   for (Credentials_Iterator i = this->credentials_table_.begin ();
00175        i != end;
00176        ++i)
00177     {
00178       creds_ids[n++] = CORBA::string_dup ((*i).ext_id_);
00179     }
00180 
00181   return creds_ids._retn ();
00182 }

SecurityLevel3::OwnCredentialsList * TAO::SL3::CredentialsCurator::default_creds_list  )  [virtual]
 

Definition at line 125 of file SL3_CredentialsCurator.cpp.

References ACE_GUARD_RETURN, ACE_NEW_THROW_EX, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::begin(), Credentials_Iterator, credentials_table_, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::end(), and TAO_SYNCH_MUTEX.

00126 {
00127   SecurityLevel3::OwnCredentialsList * list;
00128   ACE_NEW_THROW_EX (list,
00129                     SecurityLevel3::OwnCredentialsList,
00130                     CORBA::NO_MEMORY ());
00131 
00132   SecurityLevel3::OwnCredentialsList_var creds_list = list;
00133 
00134   ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
00135                     guard,
00136                     this->lock_,
00137                     0);
00138 
00139   creds_list->length (this->credentials_table_.current_size ());
00140 
00141   CORBA::ULong n = 0;
00142 
00143   const Credentials_Iterator end = this->credentials_table_.end ();
00144   for (Credentials_Iterator i = this->credentials_table_.begin ();
00145        i != end;
00146        ++i)
00147     {
00148       creds_list[n++] =
00149         SecurityLevel3::OwnCredentials::_duplicate ((*i).int_id_.in());
00150     }
00151 
00152   return creds_list._retn ();
00153 }

SecurityLevel3::OwnCredentials_ptr TAO::SL3::CredentialsCurator::get_own_credentials const char *  credentials_id  )  [virtual]
 

Definition at line 185 of file SL3_CredentialsCurator.cpp.

References ACE_GUARD_RETURN, credentials_table_, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find(), and TAO_SYNCH_MUTEX.

00187 {
00188   Credentials_Table::ENTRY * entry;
00189 
00190   ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
00191                     guard,
00192                     this->lock_,
00193                     SecurityLevel3::OwnCredentials::_nil ());
00194 
00195   if (this->credentials_table_.find (credentials_id, entry) != 0)
00196     {
00197       return SecurityLevel3::OwnCredentials::_nil ();
00198     }
00199 
00200   return
00201     SecurityLevel3::OwnCredentials::_duplicate (entry->int_id_.in ());
00202 }

void TAO::SL3::CredentialsCurator::register_acquirer_factory const char *  acquisition_method,
TAO::SL3::CredentialsAcquirerFactory factory
 

Register CredentialsAcquirer factory.

Note:
The CredentialsCurator retains ownership of the factory.

Definition at line 222 of file SL3_CredentialsCurator.cpp.

References ACE_GUARD, acquirer_factories_, ACE_Map_Manager< EXT_ID, INT_ID, ACE_LOCK >::bind(), CORBA::string_dup(), and TAO_SYNCH_MUTEX.

00225 {
00226   if (acquisition_method == 0 || factory == 0)
00227     throw CORBA::BAD_PARAM ();
00228 
00229   CORBA::String_var method = CORBA::string_dup (acquisition_method);
00230 
00231   ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->lock_);
00232 
00233   const int result =
00234     this->acquirer_factories_.bind (method.in (), factory);
00235 
00236   if (result == 1)  // Entry already exists in table.
00237     throw CORBA::BAD_INV_ORDER ();
00238   else if (result == -1)  // Failure.
00239     throw CORBA::INTERNAL ();
00240 
00241 
00242   // CredentialsCurator now owns the acquisition method id.
00243   (void) method._retn ();
00244 
00245   // Otherwise success!
00246 }

void TAO::SL3::CredentialsCurator::release_own_credentials const char *  credentials_id  )  [virtual]
 

Definition at line 205 of file SL3_CredentialsCurator.cpp.

References ACE_GUARD, credentials_table_, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find(), CORBA::string_free(), TAO_SYNCH_MUTEX, and ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::unbind().

00207 {
00208   Credentials_Table::ENTRY * entry;
00209 
00210   ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->lock_);
00211 
00212   if (this->credentials_table_.find (credentials_id, entry) == 0)
00213     {
00214       // Deallocate the external ID (a const char *) before unbinding.
00215       CORBA::string_free (const_cast<char *> (entry->ext_id_));
00216 
00217       (void) this->credentials_table_.unbind (entry);
00218     }
00219 }

SecurityLevel3::AcquisitionMethodList * TAO::SL3::CredentialsCurator::supported_methods  )  [virtual]
 

Definition at line 78 of file SL3_CredentialsCurator.cpp.

References ACE_GUARD_RETURN, ACE_NEW_THROW_EX, acquirer_factories_, ACE_Map_Manager< EXT_ID, INT_ID, ACE_LOCK >::begin(), ACE_Map_Manager< EXT_ID, INT_ID, ACE_LOCK >::end(), Factory_Iterator, CORBA::string_dup(), and TAO_SYNCH_MUTEX.

00079 {
00080   SecurityLevel3::AcquisitionMethodList * list;
00081   ACE_NEW_THROW_EX (list,
00082                     SecurityLevel3::AcquisitionMethodList,
00083                     CORBA::NO_MEMORY ());
00084   SecurityLevel3::AcquisitionMethodList_var methods = list;
00085 
00086   ACE_GUARD_RETURN (TAO_SYNCH_MUTEX,
00087                     guard,
00088                     this->lock_,
00089                     0);
00090 
00091   methods->length (this->acquirer_factories_.current_size ());
00092 
00093   CORBA::ULong n = 0;
00094 
00095   const Factory_Iterator end = this->acquirer_factories_.end ();
00096   for (Factory_Iterator i = this->acquirer_factories_.begin ();
00097        i != end;
00098        ++i)
00099     {
00100       methods[n++] = CORBA::string_dup ((*i).ext_id_);
00101     }
00102 
00103   return methods._retn ();
00104 }


Member Data Documentation

Acquirer_Factory_Table TAO::SL3::CredentialsCurator::acquirer_factories_ [private]
 

Table of CredentialsAcquirer factories.

Definition at line 144 of file SL3_CredentialsCurator.h.

Referenced by acquire_credentials(), register_acquirer_factory(), supported_methods(), and ~CredentialsCurator().

Credentials_Table TAO::SL3::CredentialsCurator::credentials_table_ [private]
 

Table of OwnCredentials.

Definition at line 147 of file SL3_CredentialsCurator.h.

Referenced by _tao_add_own_credentials(), default_creds_ids(), default_creds_list(), get_own_credentials(), release_own_credentials(), and ~CredentialsCurator().

TAO_SYNCH_MUTEX TAO::SL3::CredentialsCurator::lock_ [private]
 

Lock used to synchronize access to underlying tables.

Definition at line 141 of file SL3_CredentialsCurator.h.


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 16:10:54 2008 for TAO_Security by doxygen 1.3.6