From 5eb2d43416a6fec7d4fb280cead0260fbb61fd10 Mon Sep 17 00:00:00 2001 From: kitty Date: Tue, 10 Dec 2002 09:30:08 +0000 Subject: ChangeLogTag: Mon Nov 25 04:25:15 2002 Krishnakumar B --- ACEXML/compass/EC_Property.cpp | 329 ++++++++++++++++++++++++++------ ACEXML/compass/EC_Property.h | 9 + ACEXML/compass/PropertyFile_Handler.cpp | 6 +- 3 files changed, 282 insertions(+), 62 deletions(-) diff --git a/ACEXML/compass/EC_Property.cpp b/ACEXML/compass/EC_Property.cpp index f0f55803ec7..a0f293014dd 100644 --- a/ACEXML/compass/EC_Property.cpp +++ b/ACEXML/compass/EC_Property.cpp @@ -4,7 +4,8 @@ #include "ace/OS_String.h" ACEXML_EC_Property::ACEXML_EC_Property() - : ec_consumer_control_period_ (0), ec_supplier_control_period_ (0) + : ec_consumer_control_period_ (0), ec_supplier_control_period_ (0), + ec_dispatching_threads_ (0) {} ACEXML_EC_Property::~ACEXML_EC_Property() @@ -15,36 +16,196 @@ ACEXML_EC_Property::set (const ACEXML_String& property, const ACEXML_String& value) { const ACEXML_Char* prop = property.c_str(); - if (ACE_OS::strcmp (prop, "ECDispatching") == 0) - this->ec_dispatching_ = value; - else if (ACE_OS::strcmp (prop, "ECFiltering") == 0) - this->ec_filtering_ = value; - else if (ACE_OS::strcmp (prop, "ECSupplierFiltering") == 0) - this->ec_supplier_filtering_ = value; - else if (ACE_OS::strcmp (prop, "ECProxyConsumerLock") == 0) - this->ec_proxy_consumer_lock_ = value; - else if (ACE_OS::strcmp (prop, "ECProxySupplierLock") == 0) - this->ec_proxy_supplier_lock_ = value; - else if (ACE_OS::strcmp (prop, "ECConsumerControl") == 0) - this->ec_consumer_control_ = value; - else if (ACE_OS::strcmp (prop, "ECSupplierControl") == 0) - this->ec_supplier_control_ = value; + const ACEXML_Char* val = value.c_str(); + if (ACE_OS::strcasecmp (prop, "ECDispatching") == 0) + { + if (ACE_OS::strcasecmp (val, "reactive") == 0 || + ACE_OS::strcasecmp (val, "mt") == 0) + { + this->ec_dispatching_ = value; + if (this->ec_dispatching_threads_ <= 0) + { + ACE_ERROR ((LM_ERROR, "Invalid configuration ECDispatching = mt " + "and ECDispatchingThreads = %ld\n", + this->ec_dispatching_threads_)); + return -1; + } + return 0; + } + } + else if (ACE_OS::strcasecmp (prop, "ECFiltering") == 0) + { + if (ACE_OS::strcasecmp (val, "null") == 0 || + ACE_OS::strcasecmp (val, "basic") == 0 || + ACE_OS::strcasecmp (val, "prefix") == 0) + { + this->ec_filtering_ = value; + return 0; + } + } + else if (ACE_OS::strcasecmp (prop, "ECSupplierFiltering") == 0 || + ACE_OS::strcasecmp (prop, "ECSupplierFilter")) + { + if (ACE_OS::strcasecmp (val, "null") == 0 || + ACE_OS::strcasecmp (val, "per-supplier") == 0) + { + this->ec_supplier_filtering_ = value; + return 0; + } + } + else if (ACE_OS::strcasecmp (prop, "ECTimeout") == 0) + { + if (ACE_OS::strcasecmp (val, "reactive") == 0) + { + this->ec_timeout_ = value; + return 0; + } + } + else if (ACE_OS::strcasecmp (prop, "ECObserver") == 0) + { + if (ACE_OS::strcasecmp (val, "null") == 0 || + ACE_OS::strcasecmp (val, "basic") == 0) + { + this->ec_observer_ = value; + return 0; + } + } + else if (ACE_OS::strcasecmp (prop, "ECScheduling") == 0) + { + if (ACE_OS::strcasecmp (val, "null") == 0 || + ACE_OS::strcasecmp (val, "group") == 0) + { + this->ec_scheduling_ = value; + return 0; + } + } + else if (ACE_OS::strcasecmp (prop, "ECProxyPushConsumerCollection") == 0) + { + if (this->check_collection (val) == 0) + { + this->ec_proxy_push_consumer_collection_ = value; + return 0; + } + } + else if (ACE_OS::strcasecmp (prop, "ECProxyPushSupplierCollection") == 0) + { + if (this->check_collection (val) == 0) + { + this->ec_proxy_push_supplier_collection_ = value; + return 0; + } + } + else if (ACE_OS::strcasecmp (prop, "ECProxyConsumerLock") == 0) + { + if (ACE_OS::strcasecmp (val, "null") == 0 || + ACE_OS::strcasecmp (val, "thread") == 0 || + ACE_OS::strcasecmp (val, "recursive") == 0) + { + this->ec_proxy_consumer_lock_ = value; + return 0; + } + } + else if (ACE_OS::strcasecmp (prop, "ECProxySupplierLock") == 0) + { + if (ACE_OS::strcasecmp (val, "null") == 0 || + ACE_OS::strcasecmp (val, "thread") == 0 || + ACE_OS::strcasecmp (val, "recursive") == 0) + { + this->ec_proxy_supplier_lock_ = value; + return 0; + } + } + else if (ACE_OS::strcasecmp (prop, "ECUseORBId") == 0) + { + this->ec_orbid_ = value; + return 0; + } + else if (ACE_OS::strcasecmp (prop, "ECConsumerControl") == 0) + { + if (ACE_OS::strcasecmp (val, "null") == 0 || + ACE_OS::strcasecmp (val, "reactive") == 0) + { + this->ec_consumer_control_ = value; + return 0; + } + } + else if (ACE_OS::strcasecmp (prop, "ECSupplierControl") == 0) + { + if (ACE_OS::strcasecmp (val, "null") == 0 || + ACE_OS::strcasecmp (val, "reactive") == 0) + { + this->ec_supplier_control_ = value; + return 0; + } + } else { - ACE_ERROR ((LM_ERROR, "Unknown property %s in property file", prop)); + ACE_ERROR ((LM_ERROR, "Invalid property %s = %s\n", prop, val)); return -1; } return 0; } +int +ACEXML_EC_Property::check_collection (const ACEXML_Char* str) +{ + ACEXML_Char* opt = ACE_OS::strdup (str); + ACE_Auto_Basic_Array_Ptr cleanup_opt (opt); + ACEXML_Char* aux; + for (ACE_TCHAR* arg = ACE_OS::strtok_r (opt, ACE_TEXT(":"), &aux); + arg != 0; + arg = ACE_OS::strtok_r (0, ACE_TEXT(":"), &aux)) + { + if (ACE_OS::strcasecmp (arg, ACE_TEXT("mt")) == 0 + || ACE_OS::strcasecmp (arg, ACE_TEXT("st")) == 0 + || ACE_OS::strcasecmp (arg, ACE_TEXT("list")) == 0 + || ACE_OS::strcasecmp (arg, ACE_TEXT("rb_tree")) == 0 + || ACE_OS::strcasecmp (arg, ACE_TEXT("immediate")) == 0 + || ACE_OS::strcasecmp (arg, ACE_TEXT("copy_on_read")) == 0 + || ACE_OS::strcasecmp (arg, ACE_TEXT("copy_on_write")) == 0 + || ACE_OS::strcasecmp (arg, ACE_TEXT("delayed")) == 0) + continue; + else + return -1; + } + return 0; +} + int ACEXML_EC_Property::set (const ACEXML_String& property, const long value) { const ACEXML_Char* prop = property.c_str(); - if (ACE_OS::strcmp (prop, "ECConsumerControlPeriod") == 0) - this->ec_consumer_control_period_ = value; - else if (ACE_OS::strcmp (prop, "ECSupplierControlPeriod") == 0) - this->ec_supplier_control_period_ = value; + if (ACE_OS::strcasecmp (prop, "ECConsumerControlPeriod") == 0) + { + this->ec_consumer_control_period_ = value; + if (this->ec_consumer_control_period_ <= 0) + { + ACE_ERROR ((LM_ERROR, "Invalid configuration ECConsumerControlPeriod" + " = %ld\n")); + return -1; + } + } + else if (ACE_OS::strcasecmp (prop, "ECSupplierControlPeriod") == 0) + { + this->ec_supplier_control_period_ = value; + if (this->ec_supplier_control_period_ <= 0) + { + ACE_ERROR ((LM_ERROR, "Invalid configuration ECSupplierControlPeriod" + " = %ld\n")); + return -1; + } + } + else if (ACE_OS::strcasecmp (prop, "ECDispatchingThreads") == 0) + { + this->ec_dispatching_threads_ = value; + if (this->ec_dispatching_threads_ <= 0) + { + ACE_ERROR ((LM_ERROR, "Invalid configuration ECDispatching = mt " + "and ECDispatchingThreads = %ld\n", + this->ec_dispatching_threads_)); + return -1; + } + } else { ACE_ERROR ((LM_ERROR, "Unknown property %s in property file", prop)); @@ -56,46 +217,94 @@ ACEXML_EC_Property::set (const ACEXML_String& property, const long value) ACEXML_Char* ACEXML_EC_Property::dump() const { - ACEXML_String argv ("-ECDispatching"); - argv += " "; - argv += this->ec_dispatching_; - argv += " "; - argv += "-ECFiltering"; - argv += " "; - argv += this->ec_filtering_; - argv += " "; - argv += "-ECSupplierFiltering"; - argv += " "; - argv += this->ec_supplier_filtering_; - argv += " "; - argv += "-ECProxyConsumerLock"; - argv += " "; - argv += this->ec_proxy_consumer_lock_; - argv += " "; - argv += "-ECProxySupplierLock"; - argv += " "; - argv += this->ec_proxy_supplier_lock_; - argv += " "; - argv += "-ECConsumerControl"; - argv += " "; - argv += this->ec_consumer_control_; - argv += " "; - argv += "-ECSupplierControl"; - argv += " "; - argv += this->ec_supplier_control_; - argv += " "; - argv += "-ECConsumerControlPeriod"; - argv += " "; + ACEXML_String argv (" "); + if (this->ec_dispatching_.length()) + { + argv += " -ECDispatching "; + argv += this->ec_dispatching_; + } + if (this->ec_filtering_.length()) + { + argv += " -ECFiltering "; + argv += this->ec_filtering_; + } + if (this->ec_supplier_filtering_.length()) + { + argv += " -ECSupplierFilter "; + argv += this->ec_supplier_filtering_; + } + if (this->ec_timeout_.length()) + { + argv += " -ECTimeout "; + argv += this->ec_timeout_; + } + if (this->ec_observer_.length()) + { + argv += " -ECObserver "; + argv += this->ec_observer_; + } + if (this->ec_scheduling_.length()) + { + argv += " -ECScheduling "; + argv += this->ec_scheduling_; + } + if (this->ec_proxy_push_consumer_collection_.length()) + { + argv += " -ECProxyPushSupplierCollection "; + argv += this->ec_proxy_push_consumer_collection_; + } + if (this->ec_proxy_push_supplier_collection_.length()) + { + argv += " -ECProxyPushSupplierCollection "; + argv += this->ec_proxy_push_supplier_collection_; + } + if (this->ec_proxy_consumer_lock_.length()) + { + argv += " -ECProxyConsumerLock "; + argv += this->ec_proxy_consumer_lock_; + } + if (this->ec_proxy_supplier_lock_.length()) + { + argv += " -ECProxySupplierLock "; + argv += this->ec_proxy_supplier_lock_; + } + if (this->ec_orbid_.length()) + { + argv += " -ECUseORBId "; + argv += this->ec_orbid_; + } + if (this->ec_consumer_control_.length()) + { + argv += " -ECConsumerControl "; + argv += this->ec_consumer_control_; + } + if (this->ec_supplier_control_.length()) + { + argv += " -ECSupplierControl "; + argv += this->ec_supplier_control_; + } char temp[20] = {0}; - int pos = ACE_OS::sprintf (temp, "%ld", this->ec_consumer_control_period_); - temp[pos] = 0; - argv += temp; - argv += " "; - argv += "-ECSupplierControlPeriod"; - argv += " "; - pos = ACE_OS::sprintf (temp, "%ld", this->ec_supplier_control_period_); - temp[pos] = 0; - argv += temp; - argv += " "; + int pos = 0; + if (this->ec_consumer_control_period_ > 0) + { + argv += " -ECConsumerControlPeriod "; + pos += ACE_OS::sprintf (temp, "%ld", this->ec_consumer_control_period_); + temp[pos] = 0; + argv += temp; + } + if (this->ec_supplier_control_period_ > 0) + { + argv += " -ECSupplierControlPeriod "; + pos += ACE_OS::sprintf (temp, "%ld", this->ec_consumer_control_period_); + temp[pos] = 0; + argv += temp; + } + if (this->ec_dispatching_threads_ > 0) + { + argv += " -ECDispatchingThreads "; + pos += ACE_OS::sprintf (temp, "%ld", this->ec_consumer_control_period_); + temp[pos] = 0; + argv += temp; + } return argv.rep(); } diff --git a/ACEXML/compass/EC_Property.h b/ACEXML/compass/EC_Property.h index 43ac9d5af0f..e9f3c00d366 100644 --- a/ACEXML/compass/EC_Property.h +++ b/ACEXML/compass/EC_Property.h @@ -20,17 +20,26 @@ public: virtual ~ACEXML_EC_Property(); virtual int set (const ACEXML_String& property, const ACEXML_String& value); virtual int set (const ACEXML_String& property, const long value); + virtual int check_collection (const ACEXML_Char* str); virtual ACEXML_Char* dump() const; private: ACEXML_String ec_dispatching_; ACEXML_String ec_filtering_; ACEXML_String ec_supplier_filtering_; + ACEXML_String ec_timeout_; + ACEXML_String ec_observer_; + ACEXML_String ec_scheduling_; + ACEXML_String ec_proxy_push_consumer_collection_; + ACEXML_String ec_proxy_push_supplier_collection_; ACEXML_String ec_proxy_consumer_lock_; ACEXML_String ec_proxy_supplier_lock_; + ACEXML_String ec_orbid_; ACEXML_String ec_consumer_control_; ACEXML_String ec_supplier_control_; + long ec_consumer_control_period_; long ec_supplier_control_period_; + long ec_dispatching_threads_; }; #include "ace/post.h" diff --git a/ACEXML/compass/PropertyFile_Handler.cpp b/ACEXML/compass/PropertyFile_Handler.cpp index afef6830ceb..f95b6d4955f 100644 --- a/ACEXML/compass/PropertyFile_Handler.cpp +++ b/ACEXML/compass/PropertyFile_Handler.cpp @@ -90,10 +90,12 @@ ACEXML_PropertyFile_Handler::endElement (const ACEXML_Char *, } else if (this->atttype_ == "long") { + int save_errno = errno; long value = ACE_OS::strtol (this->value_.c_str(), 0, 10); - if (this->property_->set (this->attname_, value) != 0) + if (errno != save_errno || + this->property_->set (this->attname_, value) != 0) { - ACE_ERROR ((LM_ERROR, "Property %s = %ld invalid\n", + ACE_ERROR ((LM_ERROR, "Property %s = %ld invalid: %m\n", this->attname_.c_str(), value)); ACEXML_SAXParseException* exception = 0; ACE_NEW_NORETURN (exception, -- cgit v1.2.1