TAO_Default_Resource_Factory Class Reference

TAO's default resource factory. More...

#include <default_resource.h>

Inheritance diagram for TAO_Default_Resource_Factory:

Inheritance graph
[legend]
Collaboration diagram for TAO_Default_Resource_Factory:

Collaboration graph
[legend]
List of all members.

Member Accessors

enum  { TAO_ALLOCATOR_THREAD_LOCK }
int get_parser_names (char **&names, int &number_of_names)
int cdr_allocator_source (void)
 Modify and get the source for the CDR allocators.

virtual int use_locked_data_blocks (void) const
virtual ACE_Reactorget_reactor (void)
 Return an ACE_Reactor to be utilized.

virtual void reclaim_reactor (ACE_Reactor *)
 Reclaim reactor resources (e.g. deallocate, etc).

virtual TAO_Acceptor_Registryget_acceptor_registry (void)
 Return a reference to the acceptor registry.

virtual TAO_Connector_Registryget_connector_registry (void)
 Return a connector to be utilized.

virtual void use_local_memory_pool (bool)
 Return the Allocator's memory pool type.

virtual ACE_Allocatorinput_cdr_dblock_allocator (void)
virtual ACE_Allocatorinput_cdr_buffer_allocator (void)
virtual ACE_Allocatorinput_cdr_msgblock_allocator (void)
virtual int input_cdr_allocator_type_locked (void)
virtual ACE_Allocatoroutput_cdr_dblock_allocator (void)
virtual ACE_Allocatoroutput_cdr_buffer_allocator (void)
virtual ACE_Allocatoroutput_cdr_msgblock_allocator (void)
virtual ACE_Allocatoramh_response_handler_allocator (void)
 Access the AMH response handler allocator.

virtual ACE_Allocatorami_response_handler_allocator (void)
 Access the AMI response handler allocator.

virtual TAO_ProtocolFactorySetget_protocol_factories (void)
virtual int init_protocol_factories (void)
virtual TAO_Codeset_Managercodeset_manager (void)
 Gets the codeset manager.

virtual int cache_maximum (void) const
 This denotes the maximum number of connections that can be cached.

virtual int purge_percentage (void) const
virtual int max_muxed_connections (void) const
virtual ACE_Lockcreate_cached_connection_lock (void)
virtual ACE_Lockcreate_object_key_table_lock (void)
 Creates a lock needed for the table that stores the object keys.

virtual ACE_Lockcreate_corba_object_lock (void)
 Creates the lock for the CORBA Object.

virtual int locked_transport_cache (void)
virtual TAO_Flushing_Strategycreate_flushing_strategy (void)
virtual TAO_Connection_Purging_Strategycreate_purging_strategy (void)
 Creates the connection purging strategy.

TAO_Resource_Factory::Resource_Usage resource_usage_strategy (void) const
 Return the resource usage strategy.

virtual TAO_LF_Strategycreate_lf_strategy (void)
virtual auto_ptr< TAO_GIOP_Fragmentation_Strategycreate_fragmentation_strategy (TAO_Transport *transport, CORBA::ULong max_message_size) const
 Outgoing fragment creation strategy.

virtual void disable_factory (void)
virtual bool drop_replies_during_shutdown (void) const

Public Types


Public Member Functions

 TAO_Default_Resource_Factory (void)
 Constructor.

virtual ~TAO_Default_Resource_Factory (void)
 Destructor.

Service Configurator Hooks
virtual int init (int argc, ACE_TCHAR *argv[])
 Dynamic linking hook.

int parse_args (int argc, ACE_TCHAR *argv[])
 Parse svc.conf arguments.


Protected Types

enum  Output_CDR_Allocator_Type { LOCAL_MEMORY_POOL, DEFAULT }

Protected Member Functions

virtual ACE_Reactor_Implallocate_reactor_impl (void) const
 Obtain the reactor implementation.

int add_to_ior_parser_names (const char *)
 Add a Parser name to the list of Parser names.

void report_option_value_error (const ACE_TCHAR *option_name, const ACE_TCHAR *option_value)
virtual int load_default_protocols (void)

Protected Attributes

int use_locked_data_blocks_
 The type of data blocks that the ORB should use.

int parser_names_count_
 The number of the different types of Parsers.

char ** parser_names_
 Array consisting of the names of the parsers.

int index_
 Index of the current element in the parser_names_ array.

TAO_ProtocolFactorySet protocol_factories_
 list of loaded protocol factories.

TAO_Resource_Factory::Purging_Strategy connection_purging_type_
int cache_maximum_
int purge_percentage_
int max_muxed_connections_
int reactor_mask_signals_
 If <0> then we create reactors with signal handling disabled.

int dynamically_allocated_reactor_
int options_processed_
int factory_disabled_
Output_CDR_Allocator_Type output_cdr_allocator_type_
 Type of allocator to use for output CDR buffers.

bool use_local_memory_pool_

Private Types

enum  Lock_Type { TAO_NULL_LOCK, TAO_THREAD_LOCK }
enum  Flushing_Strategy_Type { TAO_LEADER_FOLLOWER_FLUSHING, TAO_REACTIVE_FLUSHING, TAO_BLOCKING_FLUSHING }

Private Member Functions

void init_codeset_descriptors (void)

Private Attributes

Lock_Type cached_connection_lock_type_
 Type of lock used by the cached connector.

Lock_Type object_key_table_lock_type_
 Type of lock used by the corba object.

Lock_Type corba_object_lock_type_
 Type of lock used by the corba object.

Flushing_Strategy_Type flushing_strategy_type_
 Type of flushing strategy configured.

TAO_Codeset_Managercodeset_manager_
TAO_Codeset_Descriptor_Basechar_codeset_descriptor_
TAO_Codeset_Descriptor_Basewchar_codeset_descriptor_
Resource_Usage resource_usage_strategy_
 Resource usage strategy.

bool drop_replies_
ACE_Dynamic_Service_Dependencyprincipal_

Detailed Description

TAO's default resource factory.

Using a <{resource source specifier}> as a discriminator, the factory can return resource instances which are, e.g., global, stored in thread-specific storage, stored in shared memory, etc.

Note:
When using an ORB created by a dynamically loaded object, it is generally necessary to pre-load a "Resource_Factory" prior to initializing the ORB. In the case of the TAO_Default_Resource_Factory, this can be done by adding the following Service Configurator directive to your `svc.conf' file before your the directive that loads the object that initialized your ORB:
static Resource_Factory ""
Alternatively, explicitly pre-load the Resource_Factory using the following in your code:
ACE_Service_Config::process_directive ( ACE_TEXT ("static Resource_Factory \"\"") );
In both cases, place the appropriate resource factory arguments, if any, between the quotes immediately following "Resource_Factory."

Definition at line 69 of file default_resource.h.


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
TAO_ALLOCATOR_THREAD_LOCK 

Definition at line 98 of file default_resource.h.

00099   {
00100     TAO_ALLOCATOR_THREAD_LOCK
00101   };

enum TAO_Default_Resource_Factory::Flushing_Strategy_Type [private]
 

Enumeration values:
TAO_LEADER_FOLLOWER_FLUSHING 
TAO_REACTIVE_FLUSHING 
TAO_BLOCKING_FLUSHING 

Definition at line 253 of file default_resource.h.

enum TAO_Default_Resource_Factory::Lock_Type [private]
 

Enumeration values:
TAO_NULL_LOCK 
TAO_THREAD_LOCK 

Definition at line 238 of file default_resource.h.

00239   {
00240     TAO_NULL_LOCK,
00241     TAO_THREAD_LOCK
00242   };

enum TAO_Default_Resource_Factory::Output_CDR_Allocator_Type [protected]
 

Enumeration values:
LOCAL_MEMORY_POOL 
DEFAULT 

Definition at line 219 of file default_resource.h.

00220     {
00221       LOCAL_MEMORY_POOL,
00222 #ifdef ACE_HAS_SENDFILE
00223       MMAP_ALLOCATOR,
00224 #endif  /* ACE_HAS_SENDFILE */
00225       DEFAULT
00226     };


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Default_Resource_Factory::TAO_Default_Resource_Factory void   ) 
 

Constructor.

Definition at line 38 of file default_resource.cpp.

References resource_usage_strategy_, TAO_CONNECTION_CACHE_MAXIMUM, TAO_CONNECTION_PURGING_STRATEGY, TAO_PURGE_PERCENT, TAO_USE_LOCAL_MEMORY_POOL, and TAO_USE_OUTPUT_CDR_MMAP_MEMORY_POOL.

00039   : use_locked_data_blocks_ (1)
00040   , parser_names_count_ (0)
00041   , parser_names_ (0)
00042   , protocol_factories_ ()
00043   , connection_purging_type_ (TAO_CONNECTION_PURGING_STRATEGY)
00044   , cache_maximum_ (TAO_CONNECTION_CACHE_MAXIMUM)
00045   , purge_percentage_ (TAO_PURGE_PERCENT)
00046   , max_muxed_connections_ (0)
00047   , reactor_mask_signals_ (1)
00048   , dynamically_allocated_reactor_ (0)
00049   , options_processed_ (0)
00050   , factory_disabled_ (0)
00051 #if TAO_USE_OUTPUT_CDR_MMAP_MEMORY_POOL == 1
00052   , output_cdr_allocator_type_ (MMAP_ALLOCATOR)
00053 #else
00054   , output_cdr_allocator_type_ (DEFAULT)
00055 #endif
00056 #if TAO_USE_LOCAL_MEMORY_POOL == 1
00057   , use_local_memory_pool_ (true)
00058 #else
00059   , use_local_memory_pool_ (false)
00060 #endif
00061   , cached_connection_lock_type_ (TAO_THREAD_LOCK)
00062   , object_key_table_lock_type_ (TAO_THREAD_LOCK)
00063   , corba_object_lock_type_ (TAO_THREAD_LOCK)
00064   , flushing_strategy_type_ (TAO_LEADER_FOLLOWER_FLUSHING)
00065   , codeset_manager_ (0)
00066   , char_codeset_descriptor_ (0)
00067   , wchar_codeset_descriptor_ (0)
00068   , resource_usage_strategy_ (TAO_Resource_Factory::TAO_EAGER)
00069   , drop_replies_ (true)
00070   , principal_(0)
00071 {
00072 #if TAO_USE_LAZY_RESOURCE_USAGE_STRATEGY == 1
00073   this->resource_usage_strategy_ =
00074     TAO_Resource_Factory::TAO_LAZY;
00075 #endif /*TAO_USE_LAZY_RESOURCE_USAGE_STRATEGY*/
00076 
00077 
00078 }

TAO_Default_Resource_Factory::~TAO_Default_Resource_Factory void   )  [virtual]
 

Destructor.

Definition at line 80 of file default_resource.cpp.

References ACE_Unbounded_Set< T >::begin(), codeset_manager_, ACE_Unbounded_Set< T >::end(), parser_names_, parser_names_count_, principal_, protocol_factories_, ACE_Unbounded_Set< T >::reset(), CORBA::string_free(), and TAO_ProtocolFactorySetItor.

00081 {
00082   const TAO_ProtocolFactorySetItor end = this->protocol_factories_.end ();
00083 
00084   for (TAO_ProtocolFactorySetItor iterator =
00085          this->protocol_factories_.begin ();
00086        iterator != end;
00087        ++iterator)
00088     {
00089       delete *iterator;
00090     }
00091 
00092   this->protocol_factories_.reset ();
00093 
00094   for (int i = 0; i < this->parser_names_count_; ++i)
00095     CORBA::string_free (this->parser_names_[i]);
00096 
00097   delete [] this->parser_names_;
00098 
00099   delete codeset_manager_;
00100   codeset_manager_ = 0;
00101 
00102   delete principal_;
00103 }


Member Function Documentation

int TAO_Default_Resource_Factory::add_to_ior_parser_names const char *   )  [protected]
 

Add a Parser name to the list of Parser names.

Definition at line 596 of file default_resource.cpp.

References parser_names_, and CORBA::string_dup().

Referenced by init().

00597 {
00598   this->parser_names_[this->index_] = CORBA::string_dup (curarg);
00599 
00600   ++this->index_;
00601 
00602   return 0;
00603 }

ACE_Reactor_Impl * TAO_Default_Resource_Factory::allocate_reactor_impl void   )  const [protected, virtual]
 

Obtain the reactor implementation.

Definition at line 792 of file default_resource.cpp.

References ACE_NEW_RETURN, and ACE_Timer_Queue.

00793 {
00794   ACE_Reactor_Impl *impl = 0;
00795   /*
00796    * Hook to specialize TAO's reactor implementation.
00797    */
00798 //@@ TAO_REACTOR_SPL_COMMENT_HOOK_START
00799   ACE_NEW_RETURN (impl,
00800                   ACE_TP_Reactor (ACE::max_handles (),
00801                                   1,
00802                                   (ACE_Sig_Handler*)0,
00803                                   (ACE_Timer_Queue*)0,
00804                                   this->reactor_mask_signals_,
00805                                   ACE_Select_Reactor_Token::LIFO),
00806                   0);
00807 //@@ TAO_REACTOR_SPL_COMMENT_HOOK_END
00808   return impl;
00809 }

ACE_Allocator * TAO_Default_Resource_Factory::amh_response_handler_allocator void   )  [virtual]
 

Access the AMH response handler allocator.

Reimplemented from TAO_Resource_Factory.

Definition at line 993 of file default_resource.cpp.

References ACE_NEW_RETURN, LOCKED_ALLOCATOR_NO_POOL, LOCKED_ALLOCATOR_POOL, and use_local_memory_pool_.

00994 {
00995   ACE_Allocator *allocator = 0;
00996   if (use_local_memory_pool_)
00997   {
00998     ACE_NEW_RETURN (allocator,
00999                     LOCKED_ALLOCATOR_POOL,
01000                     0);
01001   }
01002   else
01003   {
01004     ACE_NEW_RETURN (allocator,
01005                     LOCKED_ALLOCATOR_NO_POOL,
01006                     0);
01007   }
01008 
01009   return allocator;
01010 }

ACE_Allocator * TAO_Default_Resource_Factory::ami_response_handler_allocator void   )  [virtual]
 

Access the AMI response handler allocator.

Reimplemented from TAO_Resource_Factory.

Definition at line 1013 of file default_resource.cpp.

References ACE_NEW_RETURN, LOCKED_ALLOCATOR_NO_POOL, LOCKED_ALLOCATOR_POOL, and use_local_memory_pool_.

01014 {
01015   ACE_Allocator *allocator = 0;
01016   if (use_local_memory_pool_)
01017   {
01018     ACE_NEW_RETURN (allocator,
01019                     LOCKED_ALLOCATOR_POOL,
01020                     0);
01021   }
01022   else
01023   {
01024     ACE_NEW_RETURN (allocator,
01025                     LOCKED_ALLOCATOR_NO_POOL,
01026                     0);
01027   }
01028 
01029   return allocator;
01030 }

int TAO_Default_Resource_Factory::cache_maximum void   )  const [virtual]
 

This denotes the maximum number of connections that can be cached.

Reimplemented from TAO_Resource_Factory.

Definition at line 1033 of file default_resource.cpp.

01034 {
01035   return this->cache_maximum_;
01036 }

int TAO_Default_Resource_Factory::cdr_allocator_source void   ) 
 

Modify and get the source for the CDR allocators.

TAO_Codeset_Manager * TAO_Default_Resource_Factory::codeset_manager void   )  [virtual]
 

Gets the codeset manager.

Reimplemented from TAO_Resource_Factory.

Definition at line 1240 of file default_resource.cpp.

References codeset_manager_, TAO_Codeset_Manager_Factory_Base::create(), and ACE_Dynamic_Service< TYPE >::instance().

Referenced by init_codeset_descriptors().

01241 {
01242    if (this->codeset_manager_)
01243     return this->codeset_manager_;
01244 
01245   TAO_Codeset_Manager_Factory_Base *factory =
01246     ACE_Dynamic_Service<TAO_Codeset_Manager_Factory_Base>::instance ("TAO_Codeset");
01247   this->codeset_manager_ = factory->create ();
01248 
01249   return this->codeset_manager_;
01250 }

ACE_Lock * TAO_Default_Resource_Factory::create_cached_connection_lock void   )  [virtual]
 

Creates the lock for the lock needed in the Cache Map

Deprecated:

Reimplemented from TAO_Resource_Factory.

Definition at line 1052 of file default_resource.cpp.

References ACE_NEW_RETURN, and cached_connection_lock_type_.

01053 {
01054   ACE_Lock *the_lock = 0;
01055 
01056   if (this->cached_connection_lock_type_ == TAO_NULL_LOCK)
01057     ACE_NEW_RETURN (the_lock,
01058                     ACE_Lock_Adapter<ACE_SYNCH_NULL_MUTEX>,
01059                     0);
01060   else
01061     ACE_NEW_RETURN (the_lock,
01062                     ACE_Lock_Adapter<TAO_SYNCH_MUTEX>,
01063                     0);
01064 
01065   return the_lock;
01066 }

ACE_Lock * TAO_Default_Resource_Factory::create_corba_object_lock void   )  [virtual]
 

Creates the lock for the CORBA Object.

Reimplemented from TAO_Resource_Factory.

Definition at line 1096 of file default_resource.cpp.

References ACE_NEW_RETURN, and corba_object_lock_type_.

01097 {
01098   ACE_Lock *the_lock = 0;
01099 
01100   if (this->corba_object_lock_type_ == TAO_NULL_LOCK)
01101     ACE_NEW_RETURN (the_lock,
01102                     ACE_Lock_Adapter<ACE_SYNCH_NULL_MUTEX>,
01103                     0);
01104   else
01105     ACE_NEW_RETURN (the_lock,
01106                     ACE_Lock_Adapter<TAO_SYNCH_MUTEX>,
01107                     0);
01108 
01109   return the_lock;
01110 }

TAO_Flushing_Strategy * TAO_Default_Resource_Factory::create_flushing_strategy void   )  [virtual]
 

Creates the flushing strategy. The new instance is owned by the caller.

Implements TAO_Resource_Factory.

Definition at line 1113 of file default_resource.cpp.

References ACE_NEW_RETURN, flushing_strategy_type_, TAO_LEADER_FOLLOWER_FLUSHING, and TAO_REACTIVE_FLUSHING.

01114 {
01115   TAO_Flushing_Strategy *strategy = 0;
01116   if (this->flushing_strategy_type_ == TAO_LEADER_FOLLOWER_FLUSHING)
01117     ACE_NEW_RETURN (strategy,
01118                     TAO_Leader_Follower_Flushing_Strategy,
01119                     0);
01120   else if (this->flushing_strategy_type_ == TAO_REACTIVE_FLUSHING)
01121     ACE_NEW_RETURN (strategy,
01122                     TAO_Reactive_Flushing_Strategy,
01123                     0);
01124   else
01125     ACE_NEW_RETURN (strategy,
01126                     TAO_Block_Flushing_Strategy,
01127                     0);
01128   return strategy;
01129 }

auto_ptr< TAO_GIOP_Fragmentation_Strategy > TAO_Default_Resource_Factory::create_fragmentation_strategy TAO_Transport transport,
CORBA::ULong  max_message_size
const [virtual]
 

Outgoing fragment creation strategy.

Implements TAO_Resource_Factory.

Definition at line 1167 of file default_resource.cpp.

References ACE_AUTO_PTR_RESET, ACE_NEW_RETURN, TAO_DEF_GIOP_MAJOR, and TAO_DEF_GIOP_MINOR.

01170 {
01171   auto_ptr<TAO_GIOP_Fragmentation_Strategy> strategy (0);
01172 
01173   TAO_GIOP_Fragmentation_Strategy * tmp = 0;
01174 
01175   // Minimum GIOP message size is 24 (a multiple of 8):
01176   //   12   GIOP Message Header
01177   //    4   GIOP Fragment Header (request ID)
01178   // +  8   Smallest payload, including padding.
01179   //  ---
01180   //   24
01181   static CORBA::ULong const min_message_size = 24;
01182 
01183   // GIOP fragments are supported in GIOP 1.1 and better, but TAO only
01184   // supports them in 1.2 or better since GIOP 1.1 fragments do not
01185   // have a fragment message header.
01186 
01187 
01188   if (transport) // No transport.  Cannot fragment.
01189     {
01190       if (max_message_size < min_message_size
01191           || (TAO_DEF_GIOP_MAJOR == 1 && TAO_DEF_GIOP_MINOR < 2))
01192         {
01193           // No maximum was set by the user.
01194           ACE_NEW_RETURN (tmp,
01195                           TAO_Null_Fragmentation_Strategy,
01196                           strategy);
01197 
01198         }
01199       else
01200         {
01201           ACE_NEW_RETURN (tmp,
01202                           TAO_On_Demand_Fragmentation_Strategy (
01203                             transport,
01204                             max_message_size),
01205                           strategy);
01206         }
01207     }
01208 
01209   ACE_AUTO_PTR_RESET (strategy,
01210                       tmp,
01211                       TAO_GIOP_Fragmentation_Strategy);
01212 
01213   return strategy;
01214 }

TAO_LF_Strategy * TAO_Default_Resource_Factory::create_lf_strategy void   )  [virtual]
 

Creates the leader followers strategy. The new instance is owned by the caller.

Implements TAO_Resource_Factory.

Definition at line 1155 of file default_resource.cpp.

References ACE_NEW_RETURN.

01156 {
01157   TAO_LF_Strategy *strategy = 0;
01158 
01159   ACE_NEW_RETURN (strategy,
01160                   TAO_LF_Strategy_Complete,
01161                   0);
01162 
01163   return strategy;
01164 }

ACE_Lock * TAO_Default_Resource_Factory::create_object_key_table_lock void   )  [virtual]
 

Creates a lock needed for the table that stores the object keys.

Reimplemented from TAO_Resource_Factory.

Definition at line 1079 of file default_resource.cpp.

References ACE_NEW_RETURN, and object_key_table_lock_type_.

01080 {
01081   ACE_Lock *the_lock = 0;
01082 
01083   if (this->object_key_table_lock_type_ == TAO_NULL_LOCK)
01084     ACE_NEW_RETURN (the_lock,
01085                     ACE_Lock_Adapter<ACE_SYNCH_NULL_MUTEX>,
01086                     0);
01087   else
01088     ACE_NEW_RETURN (the_lock,
01089                     ACE_Lock_Adapter<TAO_SYNCH_MUTEX>,
01090                     0);
01091 
01092   return the_lock;
01093 }

TAO_Connection_Purging_Strategy * TAO_Default_Resource_Factory::create_purging_strategy void   )  [virtual]
 

Creates the connection purging strategy.

Implements TAO_Resource_Factory.

Definition at line 1132 of file default_resource.cpp.

References ACE_ERROR, ACE_NEW_RETURN, ACE_TEXT, connection_purging_type_, and LM_ERROR.

01133 {
01134   TAO_Connection_Purging_Strategy *strategy = 0;
01135 
01136   if (this->connection_purging_type_ == TAO_Resource_Factory::LRU)
01137     {
01138       ACE_NEW_RETURN (strategy,
01139                       TAO_LRU_Connection_Purging_Strategy (
01140                           this->cache_maximum ()),
01141                       0);
01142     }
01143   else
01144     {
01145       ACE_ERROR ((LM_ERROR,
01146                   ACE_TEXT ("TAO (%P|%t) - ")
01147                   ACE_TEXT ("no usable purging strategy ")
01148                   ACE_TEXT ("was found.\n")));
01149     }
01150 
01151   return strategy;
01152 }

void TAO_Default_Resource_Factory::disable_factory void   )  [virtual]
 

Disables the factory. When a new factory is installed and used, this function should be called on the previously used (default) factory. This should result in proper error reporting if the user attempts to set options on an unused factory.

Implements TAO_Resource_Factory.

Definition at line 1228 of file default_resource.cpp.

References ACE_DEBUG, ACE_TEXT, factory_disabled_, LM_WARNING, and options_processed_.

01229 {
01230   this->factory_disabled_ = 1;
01231   if (this->options_processed_)
01232     {
01233       ACE_DEBUG ((LM_WARNING,
01234                   ACE_TEXT ("TAO (%P|%t) Warning: Resource_Factory options ignored\n")
01235                   ACE_TEXT ("Default Resource Factory is disabled\n")));
01236     }
01237 }

bool TAO_Default_Resource_Factory::drop_replies_during_shutdown void   )  const [virtual]
 

Return the value of the strategy that indicates whether the ORB should wait for the replies during shutdown or drop replies during shutdown.

Implements TAO_Resource_Factory.

Definition at line 1273 of file default_resource.cpp.

References drop_replies_.

01274 {
01275   return this->drop_replies_;
01276 }

TAO_Acceptor_Registry * TAO_Default_Resource_Factory::get_acceptor_registry void   )  [virtual]
 

Return a reference to the acceptor registry.

Reimplemented from TAO_Resource_Factory.

Definition at line 768 of file default_resource.cpp.

References ACE_NEW_RETURN.

00769 {
00770   TAO_Acceptor_Registry *ar = 0;
00771 
00772   ACE_NEW_RETURN(ar,
00773                  TAO_Acceptor_Registry,
00774                  0);
00775 
00776   return ar;
00777 }

TAO_Connector_Registry * TAO_Default_Resource_Factory::get_connector_registry void   )  [virtual]
 

Return a connector to be utilized.

Reimplemented from TAO_Resource_Factory.

Definition at line 780 of file default_resource.cpp.

References ACE_NEW_RETURN.

00781 {
00782   TAO_Connector_Registry *cr = 0;
00783 
00784   ACE_NEW_RETURN(cr,
00785                  TAO_Connector_Registry,
00786                  0);
00787 
00788   return cr;
00789 }

int TAO_Default_Resource_Factory::get_parser_names char **&  names,
int &  number_of_names
[virtual]
 

Reimplemented from TAO_Resource_Factory.

Definition at line 554 of file default_resource.cpp.

References names, parser_names_, parser_names_count_, and CORBA::string_dup().

00556 {
00557   if (this->parser_names_count_ != 0)
00558     {
00559       // The user used some -ORBIORParser options, just return those.
00560       names = this->parser_names_;
00561       number_of_names = this->parser_names_count_;
00562 
00563       return 0;
00564     }
00565 
00566   // OK fallback on the hardcoded ones....
00567   this->parser_names_count_ = 5; // HOW MANY DO WE HAVE?
00568   this->parser_names_ =
00569     new char *[this->parser_names_count_];
00570 
00571   CORBA::ULong index = 0;
00572 
00573   this->parser_names_[index] = CORBA::string_dup ("DLL_Parser");
00574   ++index;
00575 
00576   this->parser_names_[index] = CORBA::string_dup ("FILE_Parser");
00577   ++index;
00578 
00579   this->parser_names_[index] = CORBA::string_dup ("CORBALOC_Parser");
00580   ++index;
00581 
00582   this->parser_names_[index] = CORBA::string_dup ("CORBANAME_Parser");
00583   ++index;
00584 
00585   this->parser_names_[index] = CORBA::string_dup ("MCAST_Parser");
00586   ++index;
00587 
00588   names = this->parser_names_;
00589 
00590   number_of_names = index;
00591 
00592   return 0;
00593 }

TAO_ProtocolFactorySet * TAO_Default_Resource_Factory::get_protocol_factories void   )  [virtual]
 

The protocol factory list is implemented in this class since a) it will be a global resource and b) it is initialized at start up and then not altered. Returns a container holding the list of loaded protocols.

Reimplemented from TAO_Resource_Factory.

Definition at line 762 of file default_resource.cpp.

References protocol_factories_.

Referenced by init().

00763 {
00764   return &protocol_factories_;
00765 }

ACE_Reactor * TAO_Default_Resource_Factory::get_reactor void   )  [virtual]
 

Return an ACE_Reactor to be utilized.

Reimplemented from TAO_Resource_Factory.

Definition at line 812 of file default_resource.cpp.

References ACE_NEW_RETURN, dynamically_allocated_reactor_, and ACE_Reactor::initialized().

00813 {
00814   ACE_Reactor *reactor = 0;
00815   ACE_NEW_RETURN (reactor,
00816                   ACE_Reactor (this->allocate_reactor_impl (), 1),
00817                   0);
00818 
00819   if (reactor->initialized () == 0)
00820     {
00821       delete reactor;
00822       reactor = 0;
00823     }
00824   else
00825     this->dynamically_allocated_reactor_ = 1;
00826 
00827   return reactor;
00828 }

int TAO_Default_Resource_Factory::init int  argc,
ACE_TCHAR argv[]
[virtual]
 

Dynamic linking hook.

CodeSet Translators

CodeSet Translators

Reimplemented from ACE_Shared_Object.

Definition at line 106 of file default_resource.cpp.

References ACE_DEBUG, ACE_ERROR, ACE_NEW_RETURN, ACE_TCHAR, ACE_TEXT, ACE_TEXT_ALWAYS_CHAR, ACE_TRACE, add_to_ior_parser_names(), TAO_Codeset_Descriptor_Base::add_translator(), ACE_OS::atoi(), cached_connection_lock_type_, char_codeset_descriptor_, connection_purging_type_, corba_object_lock_type_, DEFAULT, drop_replies_, factory_disabled_, flushing_strategy_type_, get_protocol_factories(), init_codeset_descriptors(), ACE_Unbounded_Set< T >::insert(), LM_DEBUG, LM_ERROR, LM_WARNING, LOCAL_MEMORY_POOL, max_muxed_connections_, TAO_Codeset_Descriptor_Base::ncs(), object_key_table_lock_type_, options_processed_, output_cdr_allocator_type_, parser_names_, parser_names_count_, purge_percentage_, reactor_mask_signals_, report_option_value_error(), resource_usage_strategy_, ACE_OS::strcasecmp(), ACE_OS::strncmp(), TAO_BLOCKING_FLUSHING, TAO_LEADER_FOLLOWER_FLUSHING, TAO_ProtocolFactorySet, TAO_REACTIVE_FLUSHING, use_locked_data_blocks_, and wchar_codeset_descriptor_.

00107 {
00108   ACE_TRACE ("TAO_Default_Resource_Factory::init");
00109 
00110   // If this factory has already been disabled then
00111   // print a warning and exit because any options
00112   // are useless
00113   if (this->factory_disabled_) {
00114     ACE_DEBUG ((LM_WARNING,
00115                 ACE_TEXT ("TAO (%P|%t) Warning: Resource_Factory options ")
00116                 ACE_TEXT ("ignored\n")
00117                 ACE_TEXT ("Default Resource Factory is disabled\n")));
00118     return 0;
00119   }
00120   this->options_processed_ = 1;
00121 
00122   this->parser_names_count_ = 0;
00123 
00124   int curarg = 0;
00125 
00126   for (curarg = 0; curarg < argc; ++curarg)
00127     {
00128     // Parse thro' and find the number of Parsers to be loaded.
00129     if (ACE_OS::strcasecmp (argv[curarg],
00130                             ACE_TEXT("-ORBIORParser")) == 0)
00131       ++this->parser_names_count_;
00132 
00133     ++curarg;
00134 
00135     if (curarg == (argc-1) && this->parser_names_count_ != 0)
00136       {
00137         // This is the last loop..
00138         ACE_NEW_RETURN (this->parser_names_,
00139                         char *[this->parser_names_count_],
00140                         -1);
00141 
00142         for (int i = 0;
00143              i < this->parser_names_count_;
00144              ++i)
00145           this->parser_names_[i] = 0;
00146 
00147         this->index_ = 0;
00148       }
00149   }
00150 
00151   for (curarg = 0; curarg < argc; ++curarg)
00152     {
00153       if (ACE_OS::strcasecmp (argv[curarg],
00154                                  ACE_TEXT("-ORBReactorMaskSignals")) == 0)
00155       {
00156         ++curarg;
00157         if (curarg < argc)
00158           {
00159             ACE_TCHAR* name = argv[curarg];
00160 
00161             if (ACE_OS::strcasecmp (name, ACE_TEXT("0")) == 0)
00162               this->reactor_mask_signals_ = 0;
00163             else if (ACE_OS::strcasecmp (name, ACE_TEXT("1")) == 0)
00164               this->reactor_mask_signals_= 1;
00165             else
00166               this->report_option_value_error (ACE_TEXT("-ORBReactorMaskSignals"), name);
00167           }
00168       }
00169 
00170     else if (ACE_OS::strcasecmp (argv[curarg],
00171                                  ACE_TEXT("-ORBProtocolFactory")) == 0)
00172       {
00173         TAO_ProtocolFactorySet *pset = this->get_protocol_factories ();
00174         ++curarg;
00175         if (curarg < argc)
00176           {
00177             TAO_Protocol_Item *item = 0;
00178             ACE_NEW_RETURN (item,
00179                             TAO_Protocol_Item (ACE_TEXT_ALWAYS_CHAR(argv[curarg])),
00180                             -1);
00181             if (pset->insert (item) == -1)
00182               ACE_ERROR ((LM_ERROR,
00183                           ACE_TEXT ("(%P|%t) Unable to add protocol factories ")
00184                           ACE_TEXT ("for %s: %m\n"),
00185                           argv[curarg]));
00186           }
00187       }
00188 
00189     /// CodeSet Translators
00190     else if (ACE_OS::strcasecmp (argv[curarg],
00191                                  ACE_TEXT("-ORBNativeCharCodeSet")) == 0)
00192       {
00193         ++curarg;
00194         if (curarg < argc)
00195           {
00196             if (this->char_codeset_descriptor_ == 0)
00197               this->init_codeset_descriptors();
00198             if (this->char_codeset_descriptor_)
00199               this->char_codeset_descriptor_->ncs (argv[curarg]);
00200           }
00201       }
00202 
00203     else if (ACE_OS::strcasecmp (argv[curarg],
00204                                  ACE_TEXT("-ORBNativeWCharCodeSet")) == 0)
00205       {
00206         ++curarg;
00207         if (curarg < argc)
00208           {
00209             if (this->wchar_codeset_descriptor_ == 0)
00210               this->init_codeset_descriptors();
00211             if (this->wchar_codeset_descriptor_)
00212               this->wchar_codeset_descriptor_->ncs (argv[curarg]);
00213           }
00214       }
00215 
00216     else if (ACE_OS::strcasecmp (argv[curarg],
00217                                  ACE_TEXT("-ORBCharCodesetTranslator")) == 0)
00218       {
00219         ++curarg;
00220         if (curarg < argc)
00221           {
00222             if (this->char_codeset_descriptor_ == 0)
00223               this->init_codeset_descriptors();
00224             if (this->char_codeset_descriptor_)
00225               this->char_codeset_descriptor_->add_translator (argv[curarg]);
00226           }
00227       }
00228 
00229   /// CodeSet Translators
00230     else if (ACE_OS::strcasecmp (argv[curarg],
00231                                  ACE_TEXT("-ORBWCharCodesetTranslator")) == 0)
00232       {
00233         ++curarg;
00234         if (curarg < argc)
00235           {
00236             if (this->wchar_codeset_descriptor_ == 0)
00237               this->init_codeset_descriptors();
00238             if (this->wchar_codeset_descriptor_)
00239               this->wchar_codeset_descriptor_->add_translator (argv[curarg]);
00240           }
00241       }
00242 
00243     else if (ACE_OS::strcasecmp (argv[curarg],
00244                                  ACE_TEXT("-ORBConnectionCachingStrategy")) == 0)
00245       {
00246         ++curarg;
00247 
00248         // @@todo: This needs to be removed after a few betas. The
00249         // note is being written during 1.2.3 timeframe.
00250         ACE_DEBUG ((LM_DEBUG,
00251                     ACE_TEXT ("(%P|%t) This option would be deprecated \n")
00252                     ACE_TEXT ("(%P|%t) Please use -ORBConnectionPurgingStrategy ")
00253                     ACE_TEXT ("instead \n")));
00254 
00255         if (curarg < argc)
00256           {
00257             ACE_TCHAR* name = argv[curarg];
00258 
00259             if (ACE_OS::strcasecmp (name,
00260                                     ACE_TEXT ("lru")) == 0)
00261               this->connection_purging_type_ =
00262                 TAO_Resource_Factory::LRU;
00263             else if (ACE_OS::strcasecmp (name,
00264                                          ACE_TEXT ("lfu")) == 0)
00265               this->connection_purging_type_ =
00266                 TAO_Resource_Factory::LFU;
00267             else if (ACE_OS::strcasecmp (name,
00268                                          ACE_TEXT ("fifo")) == 0)
00269               this->connection_purging_type_ =
00270                 TAO_Resource_Factory::FIFO;
00271             else if (ACE_OS::strcasecmp (name,
00272                                          ACE_TEXT ("null")) == 0)
00273               this->connection_purging_type_ =
00274                   TAO_Resource_Factory::NOOP;
00275             else
00276               this->report_option_value_error (ACE_TEXT ("-ORBConnectionCachingStrategy"), name);
00277           }
00278       }
00279     else if (ACE_OS::strcasecmp (argv[curarg],
00280                                  ACE_TEXT("-ORBConnectionPurgingStrategy")) == 0)
00281       {
00282         ++curarg;
00283 
00284         if (curarg < argc)
00285           {
00286             ACE_TCHAR* name = argv[curarg];
00287 
00288             if (ACE_OS::strcasecmp (name,
00289                                     ACE_TEXT("lru")) == 0)
00290               this->connection_purging_type_ =
00291                 TAO_Resource_Factory::LRU;
00292             else if (ACE_OS::strcasecmp (name,
00293                                          ACE_TEXT("lfu")) == 0)
00294               this->connection_purging_type_ =
00295                 TAO_Resource_Factory::LFU;
00296             else if (ACE_OS::strcasecmp (name,
00297                                          ACE_TEXT("fifo")) == 0)
00298               this->connection_purging_type_ =
00299                 TAO_Resource_Factory::FIFO;
00300             else if (ACE_OS::strcasecmp (name,
00301                                          ACE_TEXT("null")) == 0)
00302               this->connection_purging_type_ =
00303                   TAO_Resource_Factory::NOOP;
00304             else
00305               this->report_option_value_error (ACE_TEXT("-ORBConnectionPurgingStrategy"), name);
00306           }
00307       }
00308    else if (ACE_OS::strcasecmp (argv[curarg],
00309                                 ACE_TEXT("-ORBConnectionCacheMax")) == 0)
00310       {
00311         ++curarg;
00312         if (curarg < argc)
00313             this->cache_maximum_ = ACE_OS::atoi (argv[curarg]);
00314         else
00315           this->report_option_value_error (ACE_TEXT("-ORBConnectionCacheMax"), argv[curarg]);
00316       }
00317 
00318    else if (ACE_OS::strcasecmp (argv[curarg],
00319                                 ACE_TEXT("-ORBConnectionCachePurgePercentage")) == 0)
00320       {
00321         ++curarg;
00322         if (curarg < argc)
00323             this->purge_percentage_ = ACE_OS::atoi (argv[curarg]);
00324         else
00325           this->report_option_value_error (ACE_TEXT("-ORBConnectionCachePurgePercentage"),
00326                                            argv[curarg]);
00327       }
00328     else if (ACE_OS::strcasecmp (argv[curarg],
00329                                  ACE_TEXT("-ORBIORParser")) == 0)
00330       {
00331         ++curarg;
00332 
00333         if (curarg < argc)
00334           {
00335             this->add_to_ior_parser_names (ACE_TEXT_ALWAYS_CHAR(argv[curarg]));
00336           }
00337       }
00338 
00339     else if (ACE_OS::strcasecmp (argv[curarg],
00340                                  ACE_TEXT("-ORBConnectionCacheLock")) == 0)
00341       {
00342         ++curarg;
00343         if (curarg < argc)
00344           {
00345             ACE_TCHAR* name = argv[curarg];
00346 
00347             if (ACE_OS::strcasecmp (name,
00348                                     ACE_TEXT("thread")) == 0)
00349               this->cached_connection_lock_type_ = TAO_THREAD_LOCK;
00350             else if (ACE_OS::strcasecmp (name,
00351                                          ACE_TEXT("null")) == 0)
00352               {
00353                 // @@ Bug 940 :This is a sort of hack now. We need to put
00354                 // this in a common place once we get the common
00355                 // switch that is documented in bug 940...
00356                 this->use_locked_data_blocks_  = 0;
00357                 this->cached_connection_lock_type_ = TAO_NULL_LOCK;
00358               }
00359             else
00360               this->report_option_value_error (ACE_TEXT("-ORBConnectionCacheLock"), name);
00361           }
00362       }
00363     else if (ACE_OS::strcasecmp (argv[curarg],
00364                                  ACE_TEXT("-ORBObjectKeyTableLock")) == 0)
00365       {
00366         ++curarg;
00367         if (curarg < argc)
00368           {
00369             ACE_TCHAR* name = argv[curarg];
00370 
00371             if (ACE_OS::strcasecmp (name,
00372                                     ACE_TEXT("thread")) == 0)
00373               this->object_key_table_lock_type_ = TAO_THREAD_LOCK;
00374             else if (ACE_OS::strcasecmp (name,
00375                                          ACE_TEXT("null")) == 0)
00376               {
00377                 // @@ Bug 940 :This is a sort of hack now. We need to put
00378                 // this in a common place once we get the common
00379                 // switch that is documented in bug 940...
00380                 this->object_key_table_lock_type_ = TAO_NULL_LOCK;
00381               }
00382             else
00383               this->report_option_value_error (ACE_TEXT("-ORBObjectKeyTableLock"), name);
00384           }
00385       }
00386     else if (ACE_OS::strcasecmp (argv[curarg],
00387                                  ACE_TEXT("-ORBCorbaObjectLock")) == 0)
00388       {
00389         ++curarg;
00390         if (curarg < argc)
00391           {
00392             ACE_TCHAR* name = argv[curarg];
00393 
00394             if (ACE_OS::strcasecmp (name,
00395                                     ACE_TEXT("thread")) == 0)
00396               this->corba_object_lock_type_ = TAO_THREAD_LOCK;
00397             else if (ACE_OS::strcasecmp (name,
00398                                          ACE_TEXT("null")) == 0)
00399               {
00400                 // @@ Bug 940 :This is a sort of hack now. We need to put
00401                 // this in a common place once we get the common
00402                 // switch that is documented in bug 940...
00403                 this->corba_object_lock_type_ = TAO_NULL_LOCK;
00404               }
00405             else
00406               this->report_option_value_error (ACE_TEXT("-ORBCorbaObjectLock"), name);
00407           }
00408       }
00409     else if (ACE_OS::strcasecmp (argv[curarg],
00410                                  ACE_TEXT("-ORBResourceUsage")) == 0)
00411       {
00412         ++curarg;
00413         if (curarg < argc)
00414           {
00415             ACE_TCHAR* name = argv[curarg];
00416 
00417             if (ACE_OS::strcasecmp (name,
00418                                     ACE_TEXT("eager")) == 0)
00419               this->resource_usage_strategy_ = TAO_EAGER;
00420             else if (ACE_OS::strcasecmp (name,
00421                                          ACE_TEXT("lazy")) == 0)
00422               {
00423                 this->resource_usage_strategy_ = TAO_LAZY;
00424               }
00425             else
00426               this->report_option_value_error (ACE_TEXT("-ORBResourceUsage"), name);
00427           }
00428       }
00429     else if (ACE_OS::strcasecmp (argv[curarg],
00430                                  ACE_TEXT("-ORBFlushingStrategy")) == 0)
00431       {
00432         ++curarg;
00433         /*
00434          * Hook to specialize TAO's Flushing strategy implementations
00435          */
00436 //@@ FLUSHING_STRATEGY_SPL_COMMENT_HOOK_START
00437         if (curarg < argc)
00438           {
00439             ACE_TCHAR* name = argv[curarg];
00440 
00441             if (ACE_OS::strcasecmp (name,
00442                                     ACE_TEXT("leader_follower")) == 0)
00443               this->flushing_strategy_type_ = TAO_LEADER_FOLLOWER_FLUSHING;
00444             else if (ACE_OS::strcasecmp (name,
00445                                          ACE_TEXT("reactive")) == 0)
00446               this->flushing_strategy_type_ = TAO_REACTIVE_FLUSHING;
00447             else if (ACE_OS::strcasecmp (name,
00448                                          ACE_TEXT("blocking")) == 0)
00449               this->flushing_strategy_type_ = TAO_BLOCKING_FLUSHING;
00450             else
00451               this->report_option_value_error (ACE_TEXT("-ORBFlushingStrategy"), name);
00452           }
00453 //@@ FLUSHING_STRATEGY_SPL_COMMENT_HOOK_END
00454       }
00455     else if (ACE_OS::strcasecmp (argv[curarg],
00456                                  ACE_TEXT ("-ORBMuxedConnectionMax")) == 0)
00457       {
00458         ++curarg;
00459         if (curarg < argc)
00460             this->max_muxed_connections_ =
00461               ACE_OS::atoi (argv[curarg]);
00462         else
00463           this->report_option_value_error (ACE_TEXT("-ORBMuxedConnectionMax"),
00464                                            argv[curarg]);
00465       }
00466     else if (ACE_OS::strcasecmp (argv[curarg],
00467                                  ACE_TEXT("-ORBDropRepliesDuringShutdown")) == 0)
00468       {
00469         ++curarg;
00470         if (curarg < argc)
00471           {
00472             int tmp = ACE_OS::atoi (argv[curarg]);
00473 
00474             if (tmp == 0)
00475               this->drop_replies_ = false;
00476             else
00477               this->drop_replies_ = true;
00478           }
00479         else
00480           this->report_option_value_error (ACE_TEXT("-ORBDropRepliesDuringShutdown"),
00481                                            argv[curarg]);
00482       }
00483     else if (0 == ACE_OS::strcasecmp (argv[curarg],
00484                                       ACE_TEXT("-ORBOutputCDRAllocator")))
00485       {
00486         ++curarg;
00487 
00488         if (curarg < argc)
00489           {
00490             ACE_TCHAR const * const current_arg = argv[curarg];
00491 
00492             if (ACE_OS::strcasecmp (current_arg,
00493                                     ACE_TEXT("mmap")) == 0)
00494               {
00495 #ifdef ACE_HAS_SENDFILE
00496                 this->output_cdr_allocator_type_ = MMAP_ALLOCATOR;
00497 #else
00498                 ACE_DEBUG ((LM_WARNING,
00499                             ACE_TEXT ("MMAP allocator unsupport on this platform")));
00500 #endif  /* ACE_HAS_SENDFILE */
00501               }
00502             else if (ACE_OS::strcasecmp (current_arg,
00503                                          ACE_TEXT("local_memory_pool")) == 0
00504                      && this->output_cdr_allocator_type_ != DEFAULT)
00505               {
00506                 this->output_cdr_allocator_type_ = LOCAL_MEMORY_POOL;
00507               }
00508             else if (ACE_OS::strcasecmp (current_arg,
00509                                          ACE_TEXT("default")) == 0)
00510               {
00511                 this->output_cdr_allocator_type_ = DEFAULT;
00512               }
00513             else
00514               {
00515                 this->report_option_value_error (
00516                   ACE_TEXT("-ORBOutputCDRAllocator"), current_arg);
00517               }
00518           }
00519       }
00520     else if (0 == ACE_OS::strcasecmp (argv[curarg],
00521                                       ACE_TEXT("-ORBZeroCopyWrite")))
00522       {
00523 #ifdef ACE_HAS_SENDFILE
00524         this->output_cdr_allocator_type_ = MMAP_ALLOCATOR;
00525 #else
00526         ACE_DEBUG ((LM_WARNING,
00527                     ACE_TEXT ("Zero copy writes unsupported on this platform\n")));
00528 #endif  /* ACE_HAS_SENDFILE */
00529       }
00530     else if (ACE_OS::strncmp (argv[curarg],
00531                               ACE_TEXT ("-ORB"),
00532                               4) == 0)
00533       {
00534         // Can we assume there is an argument after the option?
00535         // ++curarg;
00536         ACE_ERROR ((LM_ERROR,
00537                     ACE_TEXT ("Default_Resource_Factory - ")
00538                     ACE_TEXT ("unknown option <%s>\n"),
00539                     argv[curarg]));
00540       }
00541     else
00542       {
00543         ACE_DEBUG ((LM_DEBUG,
00544                     ACE_TEXT ("Default_Resource_Factory - ")
00545                     ACE_TEXT ("ignoring option <%s>\n"),
00546                     argv[curarg]));
00547       }
00548     }
00549 
00550   return 0;
00551 }

void TAO_Default_Resource_Factory::init_codeset_descriptors void   )  [private]
 

Definition at line 1253 of file default_resource.cpp.

References TAO_Codeset_Manager::char_codeset_descriptor(), char_codeset_descriptor_, codeset_manager(), codeset_manager_, TAO_Codeset_Manager::wchar_codeset_descriptor(), and wchar_codeset_descriptor_.

Referenced by init().

01254 {
01255   if (this->char_codeset_descriptor_)
01256     return;
01257   if (this->codeset_manager() == 0)
01258     return;
01259 
01260   this->char_codeset_descriptor_ =
01261     this->codeset_manager_->char_codeset_descriptor();
01262   this->wchar_codeset_descriptor_ =
01263     this->codeset_manager_->wchar_codeset_descriptor();
01264 }

int TAO_Default_Resource_Factory::init_protocol_factories void   )  [virtual]
 

This method will loop through the protocol list and using the protocol name field this method will retrieve a pointer to the associated protocol factory from the service configurator. It is assumed that only one thread will call this method at ORB initialization. NON-THREAD-SAFE

Reimplemented from TAO_Resource_Factory.

Definition at line 719 of file default_resource.cpp.

References ACE_CString, ACE_DEBUG, ACE_ERROR_RETURN, ACE_TEXT, ACE_TEXT_CHAR_TO_TCHAR, ACE_Unbounded_Set< T >::begin(), ACE_Unbounded_Set< T >::end(), LM_DEBUG, LM_ERROR, load_default_protocols(), protocol_factories_, TAO_debug_level, and TAO_ProtocolFactorySetItor.

00720 {
00721   const TAO_ProtocolFactorySetItor end = protocol_factories_.end ();
00722   TAO_ProtocolFactorySetItor factory = protocol_factories_.begin ();
00723 
00724   if (factory == end)
00725     {
00726       return this->load_default_protocols ();
00727     }
00728 
00729   for (; factory != end; ++factory)
00730     {
00731       const ACE_CString &name = (*factory)->protocol_name ();
00732       (*factory)->factory (
00733         ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (name.c_str ()));
00734       if ((*factory)->factory () == 0)
00735         {
00736           ACE_ERROR_RETURN ((LM_ERROR,
00737                              ACE_TEXT ("TAO (%P|%t) Unable to load ")
00738                              ACE_TEXT ("protocol <%s>, %p\n"),
00739                              ACE_TEXT_CHAR_TO_TCHAR(name.c_str ()),
00740                              ACE_TEXT ("")),
00741                             -1);
00742         }
00743 
00744       if (TAO_debug_level > 0)
00745         {
00746           ACE_DEBUG ((LM_DEBUG,
00747                       ACE_TEXT ("TAO (%P|%t) Loaded protocol <%s>\n"),
00748                       ACE_TEXT_CHAR_TO_TCHAR(name.c_str ())));
00749         }
00750     }
00751 
00752   return 0;
00753 }

int TAO_Default_Resource_Factory::input_cdr_allocator_type_locked void   )  [virtual]
 

Reimplemented from TAO_Resource_Factory.

Definition at line 912 of file default_resource.cpp.

00913 {
00914   return 1;
00915 }

ACE_Allocator * TAO_Default_Resource_Factory::input_cdr_buffer_allocator void   )  [virtual]
 

Reimplemented from TAO_Resource_Factory.

Definition at line 872 of file default_resource.cpp.

References ACE_NEW_RETURN, LOCKED_ALLOCATOR_NO_POOL, LOCKED_ALLOCATOR_POOL, and use_local_memory_pool_.

00873 {
00874   ACE_Allocator *allocator = 0;
00875   if (use_local_memory_pool_)
00876   {
00877     ACE_NEW_RETURN (allocator,
00878                     LOCKED_ALLOCATOR_POOL,
00879                     0);
00880   }
00881   else
00882   {
00883     ACE_NEW_RETURN (allocator,
00884                     LOCKED_ALLOCATOR_NO_POOL,
00885                     0);
00886   }
00887 
00888   return allocator;
00889 }

ACE_Allocator * TAO_Default_Resource_Factory::input_cdr_dblock_allocator void   )  [virtual]
 

Reimplemented from TAO_Resource_Factory.

Definition at line 852 of file default_resource.cpp.

References ACE_NEW_RETURN, LOCKED_ALLOCATOR_NO_POOL, LOCKED_ALLOCATOR_POOL, and use_local_memory_pool_.

00853 {
00854   ACE_Allocator *allocator = 0;
00855   if (use_local_memory_pool_)
00856   {
00857     ACE_NEW_RETURN (allocator,
00858                     LOCKED_ALLOCATOR_POOL,
00859                     0);
00860   }
00861   else
00862   {
00863     ACE_NEW_RETURN (allocator,
00864                     LOCKED_ALLOCATOR_NO_POOL,
00865                     0);
00866   }
00867 
00868   return allocator;
00869 }

ACE_Allocator * TAO_Default_Resource_Factory::input_cdr_msgblock_allocator void   )  [virtual]
 

Reimplemented from TAO_Resource_Factory.

Definition at line 892 of file default_resource.cpp.

References ACE_NEW_RETURN, LOCKED_ALLOCATOR_NO_POOL, LOCKED_ALLOCATOR_POOL, and use_local_memory_pool_.

00893 {
00894   ACE_Allocator *allocator = 0;
00895   if (use_local_memory_pool_)
00896   {
00897     ACE_NEW_RETURN (allocator,
00898                     LOCKED_ALLOCATOR_POOL,
00899                     0);
00900   }
00901   else
00902   {
00903     ACE_NEW_RETURN (allocator,
00904                     LOCKED_ALLOCATOR_NO_POOL,
00905                     0);
00906   }
00907 
00908   return allocator;
00909 }

int TAO_Default_Resource_Factory::load_default_protocols void   )  [protected, virtual]
 

Loads the default protocols. This method is used so that the advanced_resource.cpp can call the one in default_resource.cpp without calling unnecessary functions.

Reimplemented from TAO_Resource_Factory.

Definition at line 607 of file default_resource.cpp.

References ACE_AUTO_PTR_RESET, ACE_DEBUG, ACE_ERROR, ACE_NEW_RETURN, ACE_TEXT, ACE_TEXT_CHAR_TO_TCHAR, TAO_Protocol_Item::factory(), ACE_Unbounded_Set< T >::insert(), ACE_Dynamic_Service< TYPE >::instance(), LM_DEBUG, LM_ERROR, LM_WARNING, protocol_factories_, TAO_Protocol_Item::protocol_name(), ACE_Auto_Basic_Ptr< X >::release(), and TAO_debug_level.

Referenced by init_protocol_factories().

00608 {
00609 #if defined (TAO_HAS_IIOP) && (TAO_HAS_IIOP != 0)
00610       // If the user did not list any protocols in her svc.conf file
00611       // then default to TAO's basic protocols.
00612       // You do *NOT* need modify this code to add your own protocol,
00613       // instead simply add the following to your svc.conf file:
00614       //
00615       // dynamic PP_Factory Service_Object * LIB:_make_PP_Protocol_Factory() ""
00616       // static Resource_Factory "-ORBProtocolFactory PP_Factory"
00617       //
00618       // where "PP_Factory" is the name of your protocol, i.e. the
00619       // second argument passed to the ACE_STATIC_SVC_DEFINE macro:
00620       //
00621       // ACE_STATIC_SVC_DEFINE (PP_Protocol_Factory,
00622       //                        ACE_TEXT ("PP_Factory"), ...)
00623       //
00624       // "PP_Protocol_Factory" is the name of your protocol factory
00625       // class.  A "_make_" is prepended to your protocol factory
00626       // class name by the ACE_FACTORY_DECLARE macro.  The resulting
00627       // factory function "_make_PP_Protocol_Factory()" is what should
00628       // be used in the "dynamic" line in your svc.conf file.
00629       //
00630       // LIB is the base name of the shared library that implements
00631       // the protocol.  The directory containing your library must be
00632       // in your library search path, typically defined by the
00633       // LD_LIBRARY_PATH environment variable on UNIX systems, and/or
00634       // the `/etc/ld.so.conf' file on some UNIX systems.  Remember to
00635       // run "ldconfig" if you modify `/etc/ld.so.conf'.
00636 
00637       TAO_Protocol_Factory *protocol_factory = 0;
00638       auto_ptr<TAO_Protocol_Factory> safe_protocol_factory;
00639 
00640       TAO_Protocol_Item *item = 0;
00641 
00642       // If a protocol factory is obtained from the Service
00643       // Configurator then do not transfer ownership to the
00644       // TAO_Protocol_Item.
00645       bool transfer_ownership = false;
00646 
00647       protocol_factory =
00648         ACE_Dynamic_Service<TAO_Protocol_Factory>::instance ("IIOP_Factory");
00649 
00650       if (protocol_factory == 0)
00651         {
00652           if (TAO_debug_level > 0)
00653             ACE_ERROR ((LM_WARNING,
00654                         ACE_TEXT ("TAO (%P|%t) No %s found in ")
00655                         ACE_TEXT ("Service Repository. ")
00656                         ACE_TEXT ("Using default instance IIOP ")
00657                         ACE_TEXT ("Protocol Factory.\n"),
00658                         ACE_TEXT ("IIOP Protocol Factory")));
00659 
00660           ACE_NEW_RETURN (protocol_factory,
00661                           TAO_IIOP_Protocol_Factory,
00662                           -1);
00663 
00664           ACE_AUTO_PTR_RESET (safe_protocol_factory,
00665                               protocol_factory,
00666                               TAO_Protocol_Factory);
00667 
00668           transfer_ownership = true;
00669 
00670         }
00671       else
00672         {
00673           transfer_ownership = false;
00674         }
00675 
00676       ACE_NEW_RETURN (item,
00677                       TAO_Protocol_Item ("IIOP_Factory"),
00678                       -1);
00679       // If the TAO_Protocol_Item retains ownership of the
00680       // TAO_Protocol_Factory then we used an auto_ptr<> above, so
00681       // release the TAO_Protocol_Factory from it.  Otherwise, we
00682       // obtained the TAO_Protocol_Factory from the Service
00683       // Configurator so an auto_ptr<> wasn't used since the Service
00684       // Configurator retains ownership, hence there was no need to
00685       // use an auto_ptr<> in this method.
00686       item->factory ((transfer_ownership ?
00687                       safe_protocol_factory.release () :
00688                       protocol_factory),
00689                      transfer_ownership);
00690 
00691       if (this->protocol_factories_.insert (item) == -1)
00692         {
00693           ACE_ERROR ((LM_ERROR,
00694                       ACE_TEXT ("TAO (%P|%t) Unable to add ")
00695                       ACE_TEXT ("<%s> to protocol factory set.\n"),
00696                       ACE_TEXT_CHAR_TO_TCHAR (item->protocol_name ().c_str ())));
00697 
00698           delete item;
00699 
00700           if (transfer_ownership == 0)
00701             delete protocol_factory;
00702 
00703           return -1;
00704         }
00705 
00706       if (TAO_debug_level > 0)
00707         {
00708           ACE_DEBUG ((LM_DEBUG,
00709                       ACE_TEXT ("TAO (%P|%t) Loaded default ")
00710                       ACE_TEXT ("protocol <IIOP_Factory>\n")));
00711         }
00712 
00713 #endif /* TAO_HAS_IIOP && TAO_HAS_IIOP != 0 */
00714 
00715   return 0;
00716 }

int TAO_Default_Resource_Factory::locked_transport_cache void   )  [virtual]
 

Should the transport cache have a lock or not? Return 1 if the transport cache needs to be locked else return 0

Reimplemented from TAO_Resource_Factory.

Definition at line 1069 of file default_resource.cpp.

References cached_connection_lock_type_.

01070 {
01071   if (this->cached_connection_lock_type_ == TAO_NULL_LOCK)
01072     return 0;
01073 
01074   return 1;
01075 }

int TAO_Default_Resource_Factory::max_muxed_connections void   )  const [virtual]
 

Return the number of muxed connections that are allowed for a remote endpoint

Reimplemented from TAO_Resource_Factory.

Definition at line 1045 of file default_resource.cpp.

References max_muxed_connections_.

01046 {
01047   return this->max_muxed_connections_;
01048 }

ACE_Allocator * TAO_Default_Resource_Factory::output_cdr_buffer_allocator void   )  [virtual]
 

Reimplemented from TAO_Resource_Factory.

Definition at line 938 of file default_resource.cpp.

References ACE_NEW_RETURN, DEFAULT, LOCAL_MEMORY_POOL, LOCKED_ALLOCATOR_NO_POOL, LOCKED_ALLOCATOR_POOL, and output_cdr_allocator_type_.

00939 {
00940   ACE_Allocator *allocator = 0;
00941 
00942   switch (this->output_cdr_allocator_type_)
00943     {
00944     case LOCAL_MEMORY_POOL:
00945       ACE_NEW_RETURN (allocator,
00946                       LOCKED_ALLOCATOR_POOL,
00947                       0);
00948 
00949       break;
00950 
00951 #ifdef ACE_HAS_SENDFILE
00952     case MMAP_ALLOCATOR:
00953       ACE_NEW_RETURN (allocator,
00954                       TAO_MMAP_Allocator,
00955                       0);
00956 
00957       break;
00958 #endif  /* ACE_HAS_SENDFILE */
00959 
00960     case DEFAULT:
00961     default:
00962       ACE_NEW_RETURN (allocator,
00963                       LOCKED_ALLOCATOR_NO_POOL,
00964                       0);
00965 
00966       break;
00967     }
00968 
00969   return allocator;
00970 }

ACE_Allocator * TAO_Default_Resource_Factory::output_cdr_dblock_allocator void   )  [virtual]
 

Reimplemented from TAO_Resource_Factory.

Definition at line 918 of file default_resource.cpp.

References ACE_NEW_RETURN, LOCKED_ALLOCATOR_NO_POOL, LOCKED_ALLOCATOR_POOL, and use_local_memory_pool_.

00919 {
00920   ACE_Allocator *allocator = 0;
00921   if (use_local_memory_pool_)
00922   {
00923     ACE_NEW_RETURN (allocator,
00924                     LOCKED_ALLOCATOR_POOL,
00925                     0);
00926   }
00927   else
00928   {
00929     ACE_NEW_RETURN (allocator,
00930                     LOCKED_ALLOCATOR_NO_POOL,
00931                     0);
00932   }
00933 
00934   return allocator;
00935 }

ACE_Allocator * TAO_Default_Resource_Factory::output_cdr_msgblock_allocator void   )  [virtual]
 

Reimplemented from TAO_Resource_Factory.

Definition at line 973 of file default_resource.cpp.

References ACE_NEW_RETURN, LOCKED_ALLOCATOR_NO_POOL, LOCKED_ALLOCATOR_POOL, and use_local_memory_pool_.

00974 {
00975   ACE_Allocator *allocator = 0;
00976   if (use_local_memory_pool_)
00977   {
00978     ACE_NEW_RETURN (allocator,
00979                     LOCKED_ALLOCATOR_POOL,
00980                     0);
00981   }
00982   else
00983   {
00984     ACE_NEW_RETURN (allocator,
00985                     LOCKED_ALLOCATOR_NO_POOL,
00986                     0);
00987   }
00988 
00989   return allocator;
00990 }

int TAO_Default_Resource_Factory::parse_args int  argc,
ACE_TCHAR argv[]
 

Parse svc.conf arguments.

int TAO_Default_Resource_Factory::purge_percentage void   )  const [virtual]
 

This denotes the amount of entries to remove from the connection cache.

Reimplemented from TAO_Resource_Factory.

Definition at line 1039 of file default_resource.cpp.

References purge_percentage_.

01040 {
01041   return this->purge_percentage_;
01042 }

void TAO_Default_Resource_Factory::reclaim_reactor ACE_Reactor  )  [virtual]
 

Reclaim reactor resources (e.g. deallocate, etc).

Reimplemented from TAO_Resource_Factory.

Definition at line 831 of file default_resource.cpp.

References dynamically_allocated_reactor_.

00832 {
00833   if (this->dynamically_allocated_reactor_ == 1)
00834     delete reactor;
00835 }

void TAO_Default_Resource_Factory::report_option_value_error const ACE_TCHAR option_name,
const ACE_TCHAR option_value
[protected]
 

Definition at line 1217 of file default_resource.cpp.

References ACE_DEBUG, ACE_TEXT, and LM_DEBUG.

Referenced by init().

01220 {
01221   ACE_DEBUG((LM_DEBUG,
01222              ACE_TEXT ("Default_Resource_Factory - unknown argument")
01223              ACE_TEXT (" <%s> for <%s>\n"),
01224              option_value, option_name));
01225 }

TAO_Resource_Factory::Resource_Usage TAO_Default_Resource_Factory::resource_usage_strategy void   )  const [virtual]
 

Return the resource usage strategy.

Implements TAO_Resource_Factory.

Definition at line 1267 of file default_resource.cpp.

References resource_usage_strategy_.

01268 {
01269   return this->resource_usage_strategy_;
01270 }

void TAO_Default_Resource_Factory::use_local_memory_pool bool   )  [virtual]
 

Return the Allocator's memory pool type.

Reimplemented from TAO_Resource_Factory.

Definition at line 843 of file default_resource.cpp.

References DEFAULT, LOCAL_MEMORY_POOL, output_cdr_allocator_type_, and use_local_memory_pool_.

00844 {
00845   this->use_local_memory_pool_ = flag;
00846 
00847   if (this->output_cdr_allocator_type_ == DEFAULT)
00848     this->output_cdr_allocator_type_ = LOCAL_MEMORY_POOL;
00849 }

int TAO_Default_Resource_Factory::use_locked_data_blocks void   )  const [virtual]
 

@ Backwards compatibility, return 1 if the ORB core should use Locked_Data_Blocks

Reimplemented from TAO_Resource_Factory.

Definition at line 756 of file default_resource.cpp.

References use_locked_data_blocks_.

00757 {
00758   return this->use_locked_data_blocks_;
00759 }


Member Data Documentation

int TAO_Default_Resource_Factory::cache_maximum_ [protected]
 

Specifies the maximum number of connections which should get cached in the ORB.

Definition at line 180 of file default_resource.h.

Lock_Type TAO_Default_Resource_Factory::cached_connection_lock_type_ [private]
 

Type of lock used by the cached connector.

Definition at line 245 of file default_resource.h.

Referenced by create_cached_connection_lock(), init(), and locked_transport_cache().

TAO_Codeset_Descriptor_Base* TAO_Default_Resource_Factory::char_codeset_descriptor_ [private]
 

Definition at line 264 of file default_resource.h.

Referenced by init(), and init_codeset_descriptors().

TAO_Codeset_Manager* TAO_Default_Resource_Factory::codeset_manager_ [private]
 

Definition at line 263 of file default_resource.h.

Referenced by codeset_manager(), init_codeset_descriptors(), and ~TAO_Default_Resource_Factory().

TAO_Resource_Factory::Purging_Strategy TAO_Default_Resource_Factory::connection_purging_type_ [protected]
 

Specifies the typeof purging strategy we should use for cleaning up unused connections

Definition at line 176 of file default_resource.h.

Referenced by create_purging_strategy(), and init().

Lock_Type TAO_Default_Resource_Factory::corba_object_lock_type_ [private]
 

Type of lock used by the corba object.

Definition at line 251 of file default_resource.h.

Referenced by create_corba_object_lock(), and init().

bool TAO_Default_Resource_Factory::drop_replies_ [private]
 

Flag to indicate whether replies should be dropped during ORB shutdown.

Definition at line 272 of file default_resource.h.

Referenced by drop_replies_during_shutdown(), and init().

int TAO_Default_Resource_Factory::dynamically_allocated_reactor_ [protected]
 

Flag that is set to 1 if the reactor obtained from the get_reactor() method is dynamically allocated. If this flag is set to 1, then the reclaim_reactor() method with call the delete operator on the given reactor. This flag is necessary to make sure that a reactor not allocated by the default resource factory is not reclaimed by the default resource factory. Such a situation can occur when a resource factory derived from the default one overrides the get_reactor() method but does not override the reclaim_reactor() method.

Definition at line 205 of file default_resource.h.

Referenced by get_reactor(), and reclaim_reactor().

int TAO_Default_Resource_Factory::factory_disabled_ [protected]
 

This flag specifies whether the factory has been disabled. If it has been disabled we should print warnings if options were processed before (or later).

Definition at line 217 of file default_resource.h.

Referenced by disable_factory(), and init().

Flushing_Strategy_Type TAO_Default_Resource_Factory::flushing_strategy_type_ [private]
 

Type of flushing strategy configured.

Definition at line 261 of file default_resource.h.

Referenced by create_flushing_strategy(), and init().

int TAO_Default_Resource_Factory::index_ [protected]
 

Index of the current element in the parser_names_ array.

Definition at line 169 of file default_resource.h.

int TAO_Default_Resource_Factory::max_muxed_connections_ [protected]
 

Specifies the limit on the number of muxed connections allowed per-property for the ORB. A value of 0 indicates no limit

Definition at line 189 of file default_resource.h.

Referenced by init(), and max_muxed_connections().

Lock_Type TAO_Default_Resource_Factory::object_key_table_lock_type_ [private]
 

Type of lock used by the corba object.

Definition at line 248 of file default_resource.h.

Referenced by create_object_key_table_lock(), and init().

int TAO_Default_Resource_Factory::options_processed_ [protected]
 

This flag is used to determine whether options have been processed via the init() function. It is necessary to properly report errors when the default factory is replaced.

Definition at line 212 of file default_resource.h.

Referenced by disable_factory(), and init().

Output_CDR_Allocator_Type TAO_Default_Resource_Factory::output_cdr_allocator_type_ [protected]
 

Type of allocator to use for output CDR buffers.

Definition at line 229 of file default_resource.h.

Referenced by init(), output_cdr_buffer_allocator(), and use_local_memory_pool().

char** TAO_Default_Resource_Factory::parser_names_ [protected]
 

Array consisting of the names of the parsers.

Definition at line 166 of file default_resource.h.

Referenced by add_to_ior_parser_names(), get_parser_names(), init(), and ~TAO_Default_Resource_Factory().

int TAO_Default_Resource_Factory::parser_names_count_ [protected]
 

The number of the different types of Parsers.

Definition at line 163 of file default_resource.h.

Referenced by get_parser_names(), init(), and ~TAO_Default_Resource_Factory().

ACE_Dynamic_Service_Dependency* TAO_Default_Resource_Factory::principal_ [private]
 

Definition at line 278 of file default_resource.h.

Referenced by ~TAO_Default_Resource_Factory().

TAO_ProtocolFactorySet TAO_Default_Resource_Factory::protocol_factories_ [protected]
 

list of loaded protocol factories.

Definition at line 172 of file default_resource.h.

Referenced by get_protocol_factories(), init_protocol_factories(), load_default_protocols(), and ~TAO_Default_Resource_Factory().

int TAO_Default_Resource_Factory::purge_percentage_ [protected]
 

Specifies the percentage of entries which should get purged on demand.

Definition at line 184 of file default_resource.h.

Referenced by init(), and purge_percentage().

int TAO_Default_Resource_Factory::reactor_mask_signals_ [protected]
 

If <0> then we create reactors with signal handling disabled.

Definition at line 192 of file default_resource.h.

Referenced by init().

Resource_Usage TAO_Default_Resource_Factory::resource_usage_strategy_ [private]
 

Resource usage strategy.

Definition at line 268 of file default_resource.h.

Referenced by init(), resource_usage_strategy(), and TAO_Default_Resource_Factory().

bool TAO_Default_Resource_Factory::use_local_memory_pool_ [protected]
 

This flag is used to determine whether the CDR allocators should use the local memory pool or not.

Definition at line 233 of file default_resource.h.

Referenced by amh_response_handler_allocator(), ami_response_handler_allocator(), input_cdr_buffer_allocator(), input_cdr_dblock_allocator(), input_cdr_msgblock_allocator(), output_cdr_dblock_allocator(), output_cdr_msgblock_allocator(), and use_local_memory_pool().

int TAO_Default_Resource_Factory::use_locked_data_blocks_ [protected]
 

The type of data blocks that the ORB should use.

Definition at line 160 of file default_resource.h.

Referenced by init(), and use_locked_data_blocks().

TAO_Codeset_Descriptor_Base* TAO_Default_Resource_Factory::wchar_codeset_descriptor_ [private]
 

Definition at line 265 of file default_resource.h.

Referenced by init(), and init_codeset_descriptors().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 12:13:21 2006 for TAO by doxygen 1.3.6