diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-08-13 06:49:46 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-08-13 06:49:46 +0000 |
commit | 817d2f4f068e18a989c236c8d50f0565d7c9d625 (patch) | |
tree | 2af10bb66965fba7e6afbbd00773b8a4b013bc60 | |
parent | 3a49f31bcdf1bb4f54dd8a1f9cfe4c8146efc2b1 (diff) | |
download | ATCD-817d2f4f068e18a989c236c8d50f0565d7c9d625.tar.gz |
*** empty log message ***
-rw-r--r-- | TAO/CIAO/tools/ChangeLog | 16 | ||||
-rw-r--r-- | TAO/CIAO/tools/RTComponentServer/RTComponentServer.mpc | 4 | ||||
-rw-r--r-- | TAO/CIAO/tools/RTComponentServer/RTConfig_Manager.cpp | 2 | ||||
-rw-r--r-- | TAO/CIAO/tools/RTComponentServer/RTConfig_Manager.h | 2 | ||||
-rw-r--r-- | TAO/CIAO/tools/XML_Helpers/RTConfig_Handlers.cpp | 558 | ||||
-rw-r--r-- | TAO/CIAO/tools/XML_Helpers/RTConfig_Handlers.h | 121 | ||||
-rw-r--r-- | TAO/CIAO/tools/XML_Helpers/RTConfig_Handlers.inl | 27 | ||||
-rw-r--r-- | TAO/CIAO/tools/XML_Helpers/RTConfiguration.idl | 2 | ||||
-rw-r--r-- | TAO/CIAO/tools/XML_Helpers/XMLHelpers.mpc | 8 | ||||
-rw-r--r-- | TAO/CIAO/tools/XML_Helpers/XML_Utils.h | 23 |
10 files changed, 758 insertions, 5 deletions
diff --git a/TAO/CIAO/tools/ChangeLog b/TAO/CIAO/tools/ChangeLog index 582e0e98033..4fdfc3a11b7 100644 --- a/TAO/CIAO/tools/ChangeLog +++ b/TAO/CIAO/tools/ChangeLog @@ -1,3 +1,19 @@ +Wed Aug 13 01:45:15 2003 Nanbor Wang <nanbor@cs.wustl.edu> + + * tools/XML_Helpers/XML_Utils.h: Added parse_rtcad_extension + static method. This is yet to be implemented. + + * tools/XML_Helpers/RTConfig_Handlers.h: + * tools/XML_Helpers/RTConfig_Handlers.inl: + * tools/XML_Helpers/RTConfig_Handlers.cpp: Added new files for + parsing RTConfig extention. + + * tools/XML_Helpers/RTConfiguration.idl: Renamed + RTORB_Resources_Info to RTORB_Resource_Info. + + * tools/XML_Helpers/XMLHelper.mpc: Added rtcorba as a base + project. We now depend on RTCORBA. + Sun Aug 10 13:50:15 2003 Nanbor Wang <nanbor@cs.wustl.edu> * tools/RTComponentServer/RTConfiguration.idl: diff --git a/TAO/CIAO/tools/RTComponentServer/RTComponentServer.mpc b/TAO/CIAO/tools/RTComponentServer/RTComponentServer.mpc index c0365fac762..8397a8efb40 100644 --- a/TAO/CIAO/tools/RTComponentServer/RTComponentServer.mpc +++ b/TAO/CIAO/tools/RTComponentServer/RTComponentServer.mpc @@ -4,6 +4,10 @@ project(RTComponentServer): ciao_server,rt_server { exename = RTComponentServer + libs += CIAO_XML_Helpers + libpaths += ../XML_Helpers + after += XML_Helpers + Source_Files { ComponentServer_Task.cpp RTComponentServer.cpp diff --git a/TAO/CIAO/tools/RTComponentServer/RTConfig_Manager.cpp b/TAO/CIAO/tools/RTComponentServer/RTConfig_Manager.cpp index eff557cee32..9f52a72729f 100644 --- a/TAO/CIAO/tools/RTComponentServer/RTConfig_Manager.cpp +++ b/TAO/CIAO/tools/RTComponentServer/RTConfig_Manager.cpp @@ -10,7 +10,7 @@ void CIAO::RTResource_Config_Manager::init -(const CIAO::RTConfiguration::RTORB_Resources_Info &info +(const CIAO::RTConfiguration::RTORB_Resource_Info &info ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { diff --git a/TAO/CIAO/tools/RTComponentServer/RTConfig_Manager.h b/TAO/CIAO/tools/RTComponentServer/RTConfig_Manager.h index f41a6cdd94f..064129047b9 100644 --- a/TAO/CIAO/tools/RTComponentServer/RTConfig_Manager.h +++ b/TAO/CIAO/tools/RTComponentServer/RTConfig_Manager.h @@ -50,7 +50,7 @@ namespace CIAO ~RTResource_Config_Manager (); /// Initializing the RTResource_Config_Manager - void init (const CIAO::RTConfiguration::RTORB_Resources_Info &info + void init (const CIAO::RTConfiguration::RTORB_Resource_Info &info ACE_ENV_ARG_DECL_WITH_DEFAULTS) ACE_THROW_SPEC ((CORBA::SystemException)); diff --git a/TAO/CIAO/tools/XML_Helpers/RTConfig_Handlers.cpp b/TAO/CIAO/tools/XML_Helpers/RTConfig_Handlers.cpp new file mode 100644 index 00000000000..a300222d527 --- /dev/null +++ b/TAO/CIAO/tools/XML_Helpers/RTConfig_Handlers.cpp @@ -0,0 +1,558 @@ +// $Id$ + +#include "RTConfig_Handlers.h" + +#if !defined (__ACE_INLINE__) +# include "RTConfig_Handlers.inl" +#endif /* __ACE_INLINE__ */ + +void +CIAO::RTConfig_Handler::startElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *alist + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + switch (this->state_) + { + case START: + if (ACE_OS::strcmp (qName, "rtrecources") == 0) + { + this->state_ = RTRESOURCES; + } + else if (ACE_OS::strcmp (qName, "rtpolicyset") == 0) + { + this->state_ = RTPOLICYSET; + // @@ fix me this->create_new_rtpolicyset (alist); + } + else if (ACE_OS::strcmp (qName, "rtcad-ext") == 0) + { + ACE_DEBUG ((LM_DEBUG, "Start parsing RT cad file extension\n")); + } + return; + + case RTRESOURCES: + if (ACE_OS::strcmp (qName, "threadpool") == 0) + { + this->parse_threadpool_attrs (alist + ACEXML_ENV_ARG_PARAMETER); + } + else if (ACE_OS::strcmp (qName, "threadpoolwithlanes") == 0) + { + this->state_ = TPWLANES; + this->parse_threadpoollanes_attrs (alist + ACEXML_ENV_ARG_PARAMETER); + } + else if (ACE_OS::strcmp (qName, "connectionbands") == 0) + { + this->bands_config_ = new CIAO::RTConfiguration::PriorityBands_Configuration; + const char *id; + XML_Utils::get_single_attribute ("id", + id, + alist + ACEXML_ENV_ARG_PARAMETER); + ACEXML_CHECK; + + this->bands_config_->name = id; + this->state_ = CONNBANDS; + } + return; + + case RTPOLICYSET: + if (ACE_OS::strcmp (qName, "priority_model_policy") == 0) + { + // @@ parse attributes and add it to the policy set + } + else if (ACE_OS::strcmp (qName, "threadpool_policy") == 0) + { + // @@ parse the attributes and add it to the policy set + } + else if (ACE_OS::strcmp (qName, "banded_connection_policy") == 0) + { + // @@ parse the attributes and add it to the policy set + } + else if (ACE_OS::strcmp (qName, "rtpolicyset") == 0) + { + // @@ parse the attributes and add it to the policy set + } + return; + + case TPWLANES: + if (ACE_OS::strcmp (qName, "lane") == 0) + { + this->add_threadpoollane (alist + ACEXML_ENV_ARG_PARAMETER); + } + return; + + case CONNBANDS: + if (ACE_OS::strcmp (qName, "band") == 0) + { + this->add_priorityband (alist + ACEXML_ENV_ARG_PARAMETER); + } + return; + + default: + ACEXML_THROW (ACEXML_SAXException + (ACE_TEXT ("RTConfig handler internal error"))); + return; + } + ACEXML_THROW (ACEXML_SAXException + (ACE_TEXT ("RTConfig handler internal error"))); +} + +void +CIAO::RTConfig_Handler::endElement (const ACEXML_Char *, + const ACEXML_Char *, + const ACEXML_Char *qName + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + switch (this->state_) + { + case START: + if (ACE_OS::strcmp (qName, "rtcad-ext") == 0) + { + ACE_DEBUG ((LM_DEBUG, "End parsing RT cad file extension\n")); + } + return; + + case RTRESOURCES: + if (ACE_OS::strcmp (qName, "rtresources") == 0) + this->state_ = RTPOLICYSET; + return; + + case TPWLANES: + if (ACE_OS::strcmp (qName, "threadpoolwithlanes") == 0) + { + // Store the good parsed results. + CORBA::ULong len = this->rtresources.tpl_configs.length (); + this->rtresources.tpl_configs.length (len+1); + this->rtresources.tpl_configs[len-1] = this->tpl_config_; + } + return; + + case CONNBANDS: + if (ACE_OS::strcmp (qName, "connectionbands") == 0) + { + // @@ wrap up band sequence. + } + return; + + case RTPOLICYSET: + if (ACE_OS::strcmp (qName, "rtpolicyset") == 0) + { + // @@ add the policy set to the sequence. + } + return; + + default: + ACEXML_THROW (ACEXML_SAXException + (ACE_TEXT ("RTConfig handler internal error"))); + return; + } + ACEXML_THROW (ACEXML_SAXException + (ACE_TEXT ("RTConfig handler internal error"))); +} + +// ================================================================= + +void +CIAO::RTConfig_Handler::parse_threadpool_attrs (ACEXML_Attributes *alist + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + const STACKSIZE_READ = 1; + const STATICTHR_READ = 2; + const DYNAMICTHR_READ = 4; + const DEFAULTPRIO_READ = 8; + const YES_BUFFERING_READ = 0X10; + const BUFFER_REQ_READ = 0X20; + const BUFFER_SIZE_READ = 0X40; + const TPNAME_READ = 0X80; + + // Initialize the attribute parse progress. We will turn off these + // bits one by one. At the end, the att_status should be 0. + int att_status = + STACKSIZE_READ | + STATICTHR_READ | + DYNAMICTHR_READ | + DEFAULTPRIO_READ | + YES_BUFFERING_READ | + BUFFER_REQ_READ | + BUFFER_SIZE_READ | + TPNAME_READ; + + char *endpos; + CIAO::RTConfiguration::ThreadPool_Configuration_var tp_config + = new CIAO::RTConfiguration::ThreadPool_Configuration; + + for (size_t i = 0; i < alist->getLength (); ++i) + { + const char *attName = alist->getQName (i); + const char *attValue = alist->getValue (i); + + if (ACE_OS_String::strcmp (attName, "id") == 0) + { + tp_config->name = attValue; + ACE_CLR_BITS (att_status, + TPNAME_READ); + } + else if (ACE_OS_String::strcmp (attName, "stacksize") == 0) + { + tp_config->stacksize = + strtoul (attValue, &endpos, 10); + + if (*endpos != 0) + ACEXML_THROW + (ACEXML_SAXException + ("Invalid 'stacksize' attribute in threadpool config.")); + + ACE_CLR_BITS (att_status, + STACKSIZE_READ); + } + else if (ACE_OS_String::strcmp (attName, "static_threads") == 0) + { + tp_config->static_threads = + strtoul (attValue, &endpos, 10); + + if (*endpos != 0) + ACEXML_THROW + (ACEXML_SAXException + ("Invalid 'static_threads' attribute in threadpool config.")); + + ACE_CLR_BITS (att_status, + STATICTHR_READ); + } + else if (ACE_OS_String::strcmp (attName, "dynamic_threads") == 0) + { + tp_config->dynamic_threads = + strtoul (attValue, &endpos, 10); + + if (*endpos != 0) + ACEXML_THROW + (ACEXML_SAXException + ("Invalid 'dynamic_threads' attribute in threadpool config.")); + + ACE_CLR_BITS (att_status, + DYNAMICTHR_READ); + } + else if (ACE_OS_String::strcmp (attName, "priority") == 0) + { + tp_config->default_priority = + strtoul (attValue, &endpos, 10); + + if (*endpos != 0) + ACEXML_THROW + (ACEXML_SAXException + ("Invalid 'priority' attribute in threadpool config.")); + + ACE_CLR_BITS (att_status, + DEFAULTPRIO_READ); + } + else if (ACE_OS_String::strcmp (attName, "buffering") == 0) + { + // Assuming we have a validating parser. + if (ACE_OS_String::strcmp (attName, "yes") == 0) + tp_config->allow_request_buffering = 1; + else + tp_config->allow_request_buffering = 0; + + ACE_CLR_BITS (att_status, + YES_BUFFERING_READ); + } + else if (ACE_OS_String::strcmp (attName, "max_buffer") == 0) + { + tp_config->max_buffered_requests = + strtoul (attValue, &endpos, 10); + + if (*endpos != 0) + ACEXML_THROW + (ACEXML_SAXException + ("Invalid 'max_buffer' attribute in threadpool config.")); + + ACE_CLR_BITS (att_status, + BUFFER_REQ_READ); + } + else if (ACE_OS_String::strcmp (attName, "buffer_size") == 0) + { + tp_config->max_request_buffer_size = + strtoul (attValue, &endpos, 10); + + if (*endpos != 0) + ACEXML_THROW + (ACEXML_SAXException + ("Invalid 'buffer_size' attribute in threadpool config.")); + + ACE_CLR_BITS (att_status, + BUFFER_SIZE_READ); + } + else + ACEXML_THROW + (ACEXML_SAXException + ("Invalid attribute found")); + } + if (att_status != 0) + ACEXML_THROW + (ACEXML_SAXException + ("Not all ThreadPool_Configuration attributes are set.")); + + // Store the good parsed results. + CORBA::ULong len = this->rtresources.tp_configs.length (); + this->rtresources.tp_configs.length (len+1); + this->rtresources.tp_configs[len-1] = tp_config; +} + +void +CIAO::RTConfig_Handler::parse_threadpoollanes_attrs (ACEXML_Attributes *alist + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + const STACKSIZE_READ = 1; + const YES_BORROWING_READ = 2; + const YES_BUFFERING_READ = 4; + const BUFFER_REQ_READ = 8; + const BUFFER_SIZE_READ = 0X10; + const TPNAME_READ = 0X20; + + // Initialize the attribute parse progress. We will turn off these + // bits one by one. At the end, the att_status should be 0. + int att_status = + STACKSIZE_READ | + YES_BORROWING_READ | + YES_BUFFERING_READ | + BUFFER_REQ_READ | + BUFFER_SIZE_READ | + TPNAME_READ; + + char *endpos; + this->tpl_config_ + = new CIAO::RTConfiguration::ThreadPoolLanes_Configuration; + + for (size_t i = 0; i < alist->getLength (); ++i) + { + const char *attName = alist->getQName (i); + const char *attValue = alist->getValue (i); + + if (ACE_OS_String::strcmp (attName, "id") == 0) + { + this->tpl_config_->name = attValue; + ACE_CLR_BITS (att_status, + TPNAME_READ); + } + else if (ACE_OS_String::strcmp (attName, "stacksize") == 0) + { + this->tpl_config_->stacksize = + strtoul (attValue, &endpos, 10); + + if (*endpos != 0) + ACEXML_THROW + (ACEXML_SAXException + ("Invalid 'stacksize' attribute in threadpoolwithlanes config.")); + + ACE_CLR_BITS (att_status, + STACKSIZE_READ); + } + else if (ACE_OS_String::strcmp (attName, "borrowing") == 0) + { + // Assuming we have a validating parser. + if (ACE_OS_String::strcmp (attName, "yes") == 0) + this->tpl_config_->allow_borrowing = 1; + else + this->tpl_config_->allow_borrowing = 0; + + ACE_CLR_BITS (att_status, + YES_BUFFERING_READ); + } + else if (ACE_OS_String::strcmp (attName, "buffering") == 0) + { + // Assuming we have a validating parser. + if (ACE_OS_String::strcmp (attName, "yes") == 0) + this->tpl_config_->allow_request_buffering = 1; + else + this->tpl_config_->allow_request_buffering = 0; + + ACE_CLR_BITS (att_status, + YES_BUFFERING_READ); + } + else if (ACE_OS_String::strcmp (attName, "max_buffer") == 0) + { + this->tpl_config_->max_buffered_requests = + strtoul (attValue, &endpos, 10); + + if (*endpos != 0) + ACEXML_THROW + (ACEXML_SAXException + ("Invalid 'max_buffer' attribute in threadpoolwitlanes config.")); + + ACE_CLR_BITS (att_status, + BUFFER_REQ_READ); + } + else if (ACE_OS_String::strcmp (attName, "buffer_size") == 0) + { + this->tpl_config_->max_request_buffer_size = + strtoul (attValue, &endpos, 10); + + if (*endpos != 0) + ACEXML_THROW + (ACEXML_SAXException + ("Invalid 'buffer_size' attribute in threadpoolwithlanes config.")); + + ACE_CLR_BITS (att_status, + BUFFER_SIZE_READ); + } + else + ACEXML_THROW + (ACEXML_SAXException + ("Invalid attribute in element 'threadpoolwithlanes' found")); + } + if (att_status != 0) + ACEXML_THROW + (ACEXML_SAXException + ("Not all ThreadPoolLanes_Configuration attributes are set.")); +} + +void +CIAO::RTConfig_Handler::add_threadpoollane (ACEXML_Attributes *alist + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + const PRIORITY_READ = 1; + const STATICTHR_READ = 2; + const DYNAMICTHR_READ = 4; + + // Initialize the attribute parse progress. We will turn off these + // bits one by one. At the end, the att_status should be 0. + int att_status = + PRIORITY_READ | + STATICTHR_READ | + DYNAMICTHR_READ ; + + char *endpos; + RTCORBA::ThreadpoolLane alane; + + for (size_t i = 0; i < alist->getLength (); ++i) + { + const char *attName = alist->getQName (i); + const char *attValue = alist->getValue (i); + + if (ACE_OS_String::strcmp (attName, "priority") == 0) + { + alane.lane_priority = + strtoul (attValue, &endpos, 10); + + if (*endpos != 0) + ACEXML_THROW + (ACEXML_SAXException + ("Invalid 'priority' attribute in lane config.")); + + ACE_CLR_BITS (att_status, + PRIORITY_READ); + } + else if (ACE_OS_String::strcmp (attName, "static_threads") == 0) + { + alane.static_threads = + strtoul (attValue, &endpos, 10); + + if (*endpos != 0) + ACEXML_THROW + (ACEXML_SAXException + ("Invalid 'static_threads' attribute in lane config.")); + + ACE_CLR_BITS (att_status, + STATICTHR_READ); + } + else if (ACE_OS_String::strcmp (attName, "dynamic_threads") == 0) + { + alane.dynamic_threads = + strtoul (attValue, &endpos, 10); + + if (*endpos != 0) + ACEXML_THROW + (ACEXML_SAXException + ("Invalid 'dynamic_threads' attribute in lane config.")); + + ACE_CLR_BITS (att_status, + DYNAMICTHR_READ); + } + else + ACEXML_THROW + (ACEXML_SAXException + ("Invalid attribute found in lane element")); + } + if (att_status != 0) + ACEXML_THROW + (ACEXML_SAXException + ("Not all 'lane' attributes are set.")); + + // Store the good parsed results. + CORBA::ULong len = this->tpl_config_->lanes.length (); + this->tpl_config_->lanes.length (len+1); + this->tpl_config_->lanes[len-1] = alane; +} + +void +CIAO::RTConfig_Handler::add_priorityband (ACEXML_Attributes *alist + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) +{ + const LOW_READ = 1; + const HIGH_READ = 2; + + // Initialize the attribute parse progress. We will turn off these + // bits one by one. At the end, the att_status should be 0. + int att_status = + LOW_READ | + HIGH_READ ; + + char *endpos; + RTCORBA::PriorityBand band; + + for (size_t i = 0; i < alist->getLength (); ++i) + { + const char *attName = alist->getQName (i); + const char *attValue = alist->getValue (i); + + if (ACE_OS_String::strcmp (attName, "low") == 0) + { + band.low = + strtoul (attValue, &endpos, 10); + + if (*endpos != 0) + ACEXML_THROW + (ACEXML_SAXException + ("Invalid 'low' attribute in band config.")); + + ACE_CLR_BITS (att_status, + LOW_READ); + } + else if (ACE_OS_String::strcmp (attName, "high") == 0) + { + band.high = + strtoul (attValue, &endpos, 10); + + if (*endpos != 0) + ACEXML_THROW + (ACEXML_SAXException + ("Invalid 'high' attribute in lane config.")); + + ACE_CLR_BITS (att_status, + HIGH_READ); + } + else + ACEXML_THROW + (ACEXML_SAXException + ("Invalid attribute found in band element")); + } + if (att_status != 0) + ACEXML_THROW + (ACEXML_SAXException + ("Not all 'band' attributes are set.")); + + // Store the good parsed results. + CORBA::ULong len = this->bands_config_->bands.length (); + this->bands_config_->bands.length (len+1); + this->bands_config_->bands[len-1] = band; +} diff --git a/TAO/CIAO/tools/XML_Helpers/RTConfig_Handlers.h b/TAO/CIAO/tools/XML_Helpers/RTConfig_Handlers.h new file mode 100644 index 00000000000..2369aac00dd --- /dev/null +++ b/TAO/CIAO/tools/XML_Helpers/RTConfig_Handlers.h @@ -0,0 +1,121 @@ +// $Id$ + +//============================================================================= +/** + * @file RTConfig_Handlers.h + * + * This file contains XML SAX content handler(s) for parsing CIAO's + * RT cad file extension descriptor. + * + * These handlers assume the underlying XML parser is a *validating* parser. + * + * $Id$ + * + * @author Nanbor Wang <nanbor@cs.wustl.edu> + */ +//============================================================================= + +#ifndef CIAO_ASSEMBLY_HANDLERS_H +#define CIAO_ASSEMBLY_HANDLERS_H + +#include "Cascadable_DocHandler.h" +#include "XML_Utils.h" + +namespace CIAO +{ + + /** + * @class Assembly_Handler + * + * @brief Assembly_Handler parse the root componentassembly descriptors + * + */ + class RTConfig_Handler : public CIAO::XMLHelpers::Cascadable_DocHandler + { + public: + enum CS_States + { + START, // initial state + RTRESOURCES, // parsing an rtresources element + TPWLANES, // parsing a threadpoolwithlanes element + CONNBANDS, // parsing a connectionbands element + RTPOLICYSET // parsing rtpolicyset elements + }; + + /** + * Default constructor. + */ + RTConfig_Handler (ACEXML_XMLReader *parser, + RTConfiguration::RTORB_Resource_Info &rtr, + RTConfiguration::Policy_Sets &ps + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) ; + + /** + * Default destructor. + */ + virtual ~RTConfig_Handler (void); + + // Methods inherit from ACEXML_ContentHandler. + + /** + * Receive notification of the end of an element. + */ + virtual void endElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) ; + + /** + * Receive notification of the beginning of an element. + */ + virtual void startElement (const ACEXML_Char *namespaceURI, + const ACEXML_Char *localName, + const ACEXML_Char *qName, + ACEXML_Attributes *atts ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) ; + + protected: + /// Internal state of the handler. + CS_States state_; + + /// parse the threadpool attributes + void parse_threadpool_attrs (ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)); + + /// parse the threadpoolwithlanes attributes + void parse_threadpoollanes_attrs (ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)); + + /// parse and add the threadpoollane attributes + void add_threadpoollane (ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)); + + /// parse and add the priorityband attributes + void add_priorityband (ACEXML_Attributes *atts + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)); + + private: + // Current context when filling RTConfiguration::ThreadPoolLanes_Configuration + RTConfiguration::ThreadPoolLanes_Configuration_var tpl_config_; + + // Current context when filling RTConfiguration::PriorityBands_Configuration + RTConfiguration::PriorityBands_Configuration_var bands_config_; + + // RTORB related info. + RTConfiguration::RTORB_Resource_Info &rtresources; + + // Sequence of named policy sets. + RTConfiguration::Policy_Sets &policysets; + }; + +} + +#if defined (__ACE_INLINE__) +# include "RTConfig_Handlers.inl" +#endif /* __ACE_INLINE__ */ +#endif /* CIAO_ASSEMBLY_HANDLERS_H */ diff --git a/TAO/CIAO/tools/XML_Helpers/RTConfig_Handlers.inl b/TAO/CIAO/tools/XML_Helpers/RTConfig_Handlers.inl new file mode 100644 index 00000000000..e36ba70fa5e --- /dev/null +++ b/TAO/CIAO/tools/XML_Helpers/RTConfig_Handlers.inl @@ -0,0 +1,27 @@ +// $Id$ + +ACE_INLINE +CIAO::RTConfig_Handler::RTConfig_Handler (ACEXML_XMLReader *reader, + RTConfiguration::RTORB_Resource_Info &rtr, + RTConfiguration::Policy_Sets &ps + ACEXML_ENV_ARG_DECL) + ACE_THROW_SPEC ((ACEXML_SAXException)) + : Cascadable_DocHandler (reader, + 0, + 0, + 0, + 0, + 0 + ACEXML_ENV_ARG_PARAMETER), + state_ (START), + rtresources (rtr), + policysets (ps) +{ +} + +ACE_INLINE +CIAO::RTConfig_Handler::~RTConfig_Handler (void) +{ +} + +// ================================================================= diff --git a/TAO/CIAO/tools/XML_Helpers/RTConfiguration.idl b/TAO/CIAO/tools/XML_Helpers/RTConfiguration.idl index c2462580797..20ca0de19ef 100644 --- a/TAO/CIAO/tools/XML_Helpers/RTConfiguration.idl +++ b/TAO/CIAO/tools/XML_Helpers/RTConfiguration.idl @@ -54,7 +54,7 @@ module CIAO * These are Real-time related resources that are global within an * RT component server. They can be shared by several containers. */ - struct RTORB_Resources_Info + struct RTORB_Resource_Info { ThreadPool_Configurations tp_configs; diff --git a/TAO/CIAO/tools/XML_Helpers/XMLHelpers.mpc b/TAO/CIAO/tools/XML_Helpers/XMLHelpers.mpc index 9c28a490be9..c93c547a760 100644 --- a/TAO/CIAO/tools/XML_Helpers/XMLHelpers.mpc +++ b/TAO/CIAO/tools/XML_Helpers/XMLHelpers.mpc @@ -1,6 +1,6 @@ project(XML_Helpers): acelib, acexml, rtcorba { sharedname=CIAO_XML_Helpers - idlflags += -Wb,export_include=XML_Helpers_Export.h + idlflags += -Sc -Wb,export_include=XML_Helpers_Export.h idlflags += -Wb,export_macro=CIAO_XML_HELPERS_Export dynamicflags += CIAO_XML_HELPERS_BUILD_DLL @@ -10,6 +10,7 @@ project(XML_Helpers): acelib, acexml, rtcorba { Source_Files { RTConfiguration_Stubs.cpp + RTConfig_Handlers.cpp XML_Utils.cpp Softpkg_Handlers.cpp Cascadable_DocHandler.cpp @@ -18,10 +19,13 @@ project(XML_Helpers): acelib, acexml, rtcorba { } } -project(Helper_Test): aceexe, acexml { +project(Helper_Test): aceexe, acexml, rtcorba { libs += CIAO_XML_Helpers after += XML_Helpers + IDL_Files { + } + Source_Files { main.cpp } diff --git a/TAO/CIAO/tools/XML_Helpers/XML_Utils.h b/TAO/CIAO/tools/XML_Helpers/XML_Utils.h index 18d6476d935..5fef0483761 100644 --- a/TAO/CIAO/tools/XML_Helpers/XML_Utils.h +++ b/TAO/CIAO/tools/XML_Helpers/XML_Utils.h @@ -16,6 +16,8 @@ #include "XML_Helpers_Export.h" #include "Softpkg_Handlers.h" #include "Assembly_Spec.h" +#include "RTCORBA/RTCORBA.h" +#include "RTConfigurationC.h" namespace CIAO { @@ -46,9 +48,30 @@ namespace CIAO */ static int parse_softpkg (Softpkg_Handler::Softpkg_Info *info); + /** + * @brief Parse a component assembly descriptor and extract the + * assembly specification. + */ static int parse_componentassembly (const char *filename, Assembly_Spec *spec); + /** + * @brief Parse a CIAO RT cad file extension descriptor and + * extract and prepare the information for RTComponentServer. + * + * A CIAO RT cad file extension, as defined in + * $CIAO_ROOT/doc/XML/ciao_rt_cad_ext.dtd, defines the RT + * resources and named policy sets that a RTComponentServer shall + * provides for the running components. + * + * This method assume that all the sequences, either those in + * RTORB_Resource_Info or the Policy_Sets, are empty initially and + * will add to them when parsing the RTCAD extension file. + */ + static int parse_rtcad_extension (const char *filename, + RTConfiguration::RTORB_Resource_Info &rtr, + RTConfiguration::Policy_Sets &pset); + static long get_id_and_cardinality (const char *&id, ACEXML_Attributes *atts ACEXML_ENV_ARG_DECL) |