00001
00002
00003 #include "orbsvcs/Event/EC_TPC_Factory.h"
00004
00005 #include "orbsvcs/Event/EC_TPC_Dispatching.h"
00006 #include "orbsvcs/Event/EC_TPC_ProxySupplier.h"
00007 #include "orbsvcs/Event/EC_TPC_ProxyConsumer.h"
00008
00009 #include "tao/ORB_Core.h"
00010
00011 #include "ace/Arg_Shifter.h"
00012 #include "ace/Sched_Params.h"
00013 #include "ace/OS_NS_strings.h"
00014
00015 ACE_RCSID(Event, EC_TPC_Factory, "EC_TPC_Factory.cpp,v 1.4 2006/03/14 06:14:25 jtc Exp")
00016
00017 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00018
00019 unsigned long EC_TPC_debug_level;
00020
00021 TAO_EC_TPC_Factory::TAO_EC_TPC_Factory (void)
00022 {
00023 EC_TPC_debug_level = 0;
00024 }
00025
00026 TAO_EC_TPC_Factory::~TAO_EC_TPC_Factory (void)
00027 {
00028 }
00029
00030 int
00031 TAO_EC_TPC_Factory::init_svcs (void)
00032 {
00033 TAO_EC_Simple_Queue_Full_Action::init_svcs();
00034 return ACE_Service_Config::static_svcs ()->
00035 insert (&ace_svc_desc_TAO_EC_TPC_Factory);
00036 }
00037
00038 int
00039 TAO_EC_TPC_Factory::init (int argc, char* argv[])
00040 {
00041 ACE_Arg_Shifter arg_shifter (argc, argv);
00042
00043 while (arg_shifter.is_anything_left ())
00044 {
00045 const char *arg = arg_shifter.get_current ();
00046
00047 if (ACE_OS::strcasecmp (arg, "-ECDispatching") == 0)
00048 {
00049 arg_shifter.consume_arg ();
00050
00051 if (arg_shifter.is_parameter_next ())
00052 {
00053
00054
00055
00056
00057 ACE_DEBUG ((LM_ERROR,
00058 "EC_TPC_Factory - "
00059 "-ECDispatching not supported with TPC_Factory; ignoring the option and using thread-per-consumer dispatch strategy\n"));
00060 arg_shifter.consume_arg ();
00061 }
00062 }
00063 if (ACE_OS::strcasecmp (arg, "-ECTPCDebug") == 0)
00064 {
00065 arg_shifter.consume_arg ();
00066 ++EC_TPC_debug_level;
00067 }
00068 else
00069 {
00070 arg_shifter.ignore_arg ();
00071 }
00072
00073 }
00074
00075 return TAO_EC_Default_Factory::init (argc, argv);
00076 }
00077
00078
00079
00080 TAO_EC_Dispatching*
00081 TAO_EC_TPC_Factory::create_dispatching (TAO_EC_Event_Channel_Base *)
00082 {
00083 if (EC_TPC_debug_level > 0)
00084 ACE_DEBUG ((LM_DEBUG, "EC (%P|%t) EC_TPC_Factory::create_dispatching\n"));
00085
00086 TAO_EC_Queue_Full_Service_Object* so =
00087 this->find_service_object (this->queue_full_service_object_name_.fast_rep(),
00088 TAO_EC_DEFAULT_QUEUE_FULL_SERVICE_OBJECT_NAME);
00089
00090 return new TAO_EC_TPC_Dispatching (so);
00091 }
00092
00093
00094 TAO_EC_ProxyPushSupplier*
00095 TAO_EC_TPC_Factory::create_proxy_push_supplier (TAO_EC_Event_Channel_Base *ec)
00096 {
00097 if (EC_TPC_debug_level > 0)
00098 ACE_DEBUG ((LM_DEBUG, "EC (%P|%t) EC_TPC_Factory::create_proxy_push_supplier\n"));
00099 return new TAO_EC_TPC_ProxyPushSupplier (ec, this->consumer_validate_connection_);
00100 }
00101
00102
00103 TAO_EC_ProxyPushConsumer*
00104 TAO_EC_TPC_Factory::create_proxy_push_consumer (TAO_EC_Event_Channel_Base *ec)
00105 {
00106 if (EC_TPC_debug_level > 0)
00107 ACE_DEBUG ((LM_DEBUG, "EC (%P|%t) EC_TPC_Factory::create_proxy_push_consumer\n"));
00108 return new TAO_EC_TPC_ProxyPushConsumer (ec);
00109 }
00110
00111 TAO_END_VERSIONED_NAMESPACE_DECL
00112
00113
00114
00115 ACE_STATIC_SVC_DEFINE (TAO_EC_TPC_Factory,
00116 ACE_TEXT ("EC_Factory"),
00117 ACE_SVC_OBJ_T,
00118 &ACE_SVC_NAME (TAO_EC_TPC_Factory),
00119 ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
00120 0)
00121 ACE_FACTORY_DEFINE (TAO_RTEvent_Serv, TAO_EC_TPC_Factory)
00122
00123
00124