diff options
author | mxiong <mxiong@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2006-03-28 23:07:28 +0000 |
---|---|---|
committer | mxiong <mxiong@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2006-03-28 23:07:28 +0000 |
commit | e686c901d08ce385595ac5a765c1f85f312266b3 (patch) | |
tree | 1d1bb0ccf89de1b94cd9514e198f8dd230076ec8 | |
parent | 31f4b54b7078ce0033cc6b6d81e77b80a26d9f92 (diff) | |
download | ATCD-e686c901d08ce385595ac5a765c1f85f312266b3.tar.gz |
ChangeLogTag:Tue Mar 28 23:03:59 UTC 2006 xiong,ming <ming.xiong@vanderbilt.edu>
8 files changed, 655 insertions, 72 deletions
diff --git a/TAO/CIAO/ciao/Deployment_Events.idl b/TAO/CIAO/ciao/Deployment_Events.idl index 6f69541f66f..aa4dca9ef32 100644 --- a/TAO/CIAO/ciao/Deployment_Events.idl +++ b/TAO/CIAO/ciao/Deployment_Events.idl @@ -42,6 +42,7 @@ module CIAO struct EventFilter { + string name; FilterType type; EventSourceSet sources; }; diff --git a/TAO/CIAO/docs/schema/CIAOEvents.xsd b/TAO/CIAO/docs/schema/CIAOEvents.xsd index 125b7f5fa24..6ea307609f3 100644 --- a/TAO/CIAO/docs/schema/CIAOEvents.xsd +++ b/TAO/CIAO/docs/schema/CIAOEvents.xsd @@ -31,7 +31,7 @@ <xsd:complexType name="CIAOEventsDef"> <xsd:sequence> - <xsd:element name="eventServiceConfiguration" type="CIAO:EventServiceDescription" minOccurs="1" maxOccurs="unbounded"/> + <xsd:element name="eventServiceConfiguration" type="CIAO:EventServiceDescription" maxOccurs="unbounded"/> </xsd:sequence> <xsd:attribute name="id" type="xsd:ID"/> </xsd:complexType> @@ -42,11 +42,13 @@ <xsd:element name="node" type="xsd:string"/> <xsd:element name="type" type="CIAO:EventServiceType"/> <xsd:element name="svc_cfg_file" type="xsd:string"/> - - <xsd:element name="filter" type="CIAO:FilterType" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="filter" type="CIAO:Filter" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> <xsd:attribute name="id" type="xsd:ID"/> </xsd:complexType> + + + <!-- =============================================================== --> <!-- CIAO Event Filter Description --> @@ -63,8 +65,9 @@ <xsd:complexType name="Filter"> <xsd:sequence> + <xsd:element name="name" type="xsd:string"/> <xsd:element name="type" type="CIAO:FilterType"/> - <xsd:element name="source" type="xsd:string" minOccurs="1"/> + <xsd:element name="source" type="xsd:string" maxOccurs="unbounded"/> </xsd:sequence> <xsd:attribute name="id" type="xsd:ID"/> </xsd:complexType> diff --git a/TAO/CIAO/examples/Hello/descriptors_events/ciao-events-example-with-filters.ced b/TAO/CIAO/examples/Hello/descriptors_events/ciao-events-example-with-filters.ced index 65807bb1c2b..916a9e465c7 100644 --- a/TAO/CIAO/examples/Hello/descriptors_events/ciao-events-example-with-filters.ced +++ b/TAO/CIAO/examples/Hello/descriptors_events/ciao-events-example-with-filters.ced @@ -12,23 +12,19 @@ <type>RTEC</type> <svc_cfg_file>svc.conf</svc_cfg_file> - <eventFilter> - <name>my_filter_01</name> - <type>disjunction<disjunction> - <sourceSet> - <source>Hello-Sender-idd_click_out</source> - <source>Hello-Sender-idd-02_click_out</source> - </sourceSet> - </eventFilter> + <filter> + <name>my_filter_01</name> + <type>DISJUNCTION</type> + <source>Hello-Sender-idd_click_out</source> + <source>Hello-Sender-idd-02_click_out</source> + </filter> - <eventFilter> - <name>my_filter_02</name> - <type>conjunction<disjunction> - <sourceSet> - <source>Hello-Sender-idd_click_out</source> - <source>Hello-Sender-idd-02_click_out</source> - </sourceSet> - </eventFilter> + <filter> + <name>my_filter_02</name> + <type>CONJUNCTION</type> + <source>Hello-Sender-idd_click_out</source> + <source>Hello-Sender-idd-02_click_out</source> + </filter> </eventServiceConfiguration> <eventServiceConfiguration id="es_configuration-02"> diff --git a/TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAOEvents.cpp b/TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAOEvents.cpp index db6b7dc0c18..de7c731b954 100644 --- a/TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAOEvents.cpp +++ b/TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAOEvents.cpp @@ -194,6 +194,10 @@ namespace CIAO node_->container (this); type_->container (this); svc_cfg_file_->container (this); + { + for (filter_const_iterator i (s.filter_.begin ());i != s.filter_.end ();++i) add_filter (*i); + } + if (id_.get ()) id_->container (this); } @@ -208,6 +212,11 @@ namespace CIAO svc_cfg_file (s.svc_cfg_file ()); + filter_.clear (); + { + for (filter_const_iterator i (s.filter_.begin ());i != s.filter_.end ();++i) add_filter (*i); + } + if (s.id_.get ()) id (*(s.id_)); else id_ = ::std::auto_ptr< ::XMLSchema::ID< ACE_TCHAR > > (0); @@ -273,6 +282,44 @@ namespace CIAO // EventServiceDescription // + EventServiceDescription::filter_iterator EventServiceDescription:: + begin_filter () + { + return filter_.begin (); + } + + EventServiceDescription::filter_iterator EventServiceDescription:: + end_filter () + { + return filter_.end (); + } + + EventServiceDescription::filter_const_iterator EventServiceDescription:: + begin_filter () const + { + return filter_.begin (); + } + + EventServiceDescription::filter_const_iterator EventServiceDescription:: + end_filter () const + { + return filter_.end (); + } + + void EventServiceDescription:: + add_filter (::CIAO::Config_Handlers::Filter const& e) + { + filter_.push_back (e); + } + + size_t EventServiceDescription:: + count_filter(void) const + { + return filter_.size (); + } + + // EventServiceDescription + // bool EventServiceDescription:: id_p () const { @@ -338,38 +385,47 @@ namespace CIAO // Filter:: - Filter (::CIAO::Config_Handlers::FilterType const& type__, - ::XMLSchema::string< ACE_TCHAR > const& source__) + Filter (::XMLSchema::string< ACE_TCHAR > const& name__, + ::CIAO::Config_Handlers::FilterType const& type__) : ::XSCRT::Type (), + name_ (new ::XMLSchema::string< ACE_TCHAR > (name__)), type_ (new ::CIAO::Config_Handlers::FilterType (type__)), - source_ (new ::XMLSchema::string< ACE_TCHAR > (source__)), regulator__ () { + name_->container (this); type_->container (this); - source_->container (this); } Filter:: Filter (::CIAO::Config_Handlers::Filter const& s) : ::XSCRT::Type (), + name_ (new ::XMLSchema::string< ACE_TCHAR > (*s.name_)), type_ (new ::CIAO::Config_Handlers::FilterType (*s.type_)), - source_ (new ::XMLSchema::string< ACE_TCHAR > (*s.source_)), id_ (s.id_.get () ? new ::XMLSchema::ID< ACE_TCHAR > (*s.id_) : 0), regulator__ () { + name_->container (this); type_->container (this); - source_->container (this); + { + for (source_const_iterator i (s.source_.begin ());i != s.source_.end ();++i) add_source (*i); + } + if (id_.get ()) id_->container (this); } ::CIAO::Config_Handlers::Filter& Filter:: operator= (::CIAO::Config_Handlers::Filter const& s) { + name (s.name ()); + type (s.type ()); - source (s.source ()); + source_.clear (); + { + for (source_const_iterator i (s.source_.begin ());i != s.source_.end ();++i) add_source (*i); + } if (s.id_.get ()) id (*(s.id_)); else id_ = ::std::auto_ptr< ::XMLSchema::ID< ACE_TCHAR > > (0); @@ -380,6 +436,20 @@ namespace CIAO // Filter // + ::XMLSchema::string< ACE_TCHAR > const& Filter:: + name () const + { + return *name_; + } + + void Filter:: + name (::XMLSchema::string< ACE_TCHAR > const& e) + { + *name_ = e; + } + + // Filter + // ::CIAO::Config_Handlers::FilterType const& Filter:: type () const { @@ -394,16 +464,40 @@ namespace CIAO // Filter // - ::XMLSchema::string< ACE_TCHAR > const& Filter:: - source () const + Filter::source_iterator Filter:: + begin_source () { - return *source_; + return source_.begin (); + } + + Filter::source_iterator Filter:: + end_source () + { + return source_.end (); + } + + Filter::source_const_iterator Filter:: + begin_source () const + { + return source_.begin (); + } + + Filter::source_const_iterator Filter:: + end_source () const + { + return source_.end (); } void Filter:: - source (::XMLSchema::string< ACE_TCHAR > const& e) + add_source (::XMLSchema::string< ACE_TCHAR > const& e) { - *source_ = e; + source_.push_back (e); + } + + size_t Filter:: + count_source(void) const + { + return source_.size (); } // Filter @@ -902,7 +996,6 @@ namespace CIAO namespace Config_Handlers { - // EventServiceType // @@ -1022,6 +1115,12 @@ namespace CIAO svc_cfg_file_->container (this); } + else if (n == "filter") + { + ::CIAO::Config_Handlers::Filter t (e); + add_filter (t); + } + else { } @@ -1096,7 +1195,13 @@ namespace CIAO ::XSCRT::XML::Element< ACE_TCHAR > e (p.next_element ()); ::std::basic_string< ACE_TCHAR > n (::XSCRT::XML::uq_name (e.name ())); - if (n == "type") + if (n == "name") + { + name_ = ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > (new ::XMLSchema::string< ACE_TCHAR > (e)); + name_->container (this); + } + + else if (n == "type") { type_ = ::std::auto_ptr< ::CIAO::Config_Handlers::FilterType > (new ::CIAO::Config_Handlers::FilterType (e)); type_->container (this); @@ -1104,8 +1209,8 @@ namespace CIAO else if (n == "source") { - source_ = ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > (new ::XMLSchema::string< ACE_TCHAR > (e)); - source_->container (this); + ::XMLSchema::string< ACE_TCHAR > t (e); + add_source (t); } else @@ -1335,7 +1440,6 @@ namespace CIAO namespace Config_Handlers { - ::CIAO::Config_Handlers::CIAOEventsDef CIAOEvents (xercesc::DOMDocument const* d) { @@ -1362,7 +1466,6 @@ namespace CIAO namespace Config_Handlers { - namespace { ::XMLSchema::TypeInfoInitializer < ACE_TCHAR > XMLSchemaTypeInfoInitializer_ (::XSCRT::extended_type_info_map ()); @@ -1504,7 +1607,6 @@ namespace CIAO namespace Config_Handlers { - namespace Traversal { // CIAOEventsDef @@ -1655,6 +1757,7 @@ namespace CIAO node (o); type (o); svc_cfg_file (o); + filter (o); if (o.id_p ()) id (o); else id_none (o); post (o); @@ -1668,6 +1771,7 @@ namespace CIAO node (o); type (o); svc_cfg_file (o); + filter (o); if (o.id_p ()) id (o); else id_none (o); post (o); @@ -1732,6 +1836,90 @@ namespace CIAO } void EventServiceDescription:: + filter (Type& o) + { + // VC6 anathema strikes again + // + EventServiceDescription::Type::filter_iterator b (o.begin_filter()), e (o.end_filter()); + + if (b != e) + { + filter_pre (o); + for (; b != e;) + { + dispatch (*b); + if (++b != e) filter_next (o); + } + + filter_post (o); + } + + else filter_none (o); + } + + void EventServiceDescription:: + filter (Type const& o) + { + // VC6 anathema strikes again + // + EventServiceDescription::Type::filter_const_iterator b (o.begin_filter()), e (o.end_filter()); + + if (b != e) + { + filter_pre (o); + for (; b != e;) + { + dispatch (*b); + if (++b != e) filter_next (o); + } + + filter_post (o); + } + + else filter_none (o); + } + + void EventServiceDescription:: + filter_pre (Type&) + { + } + + void EventServiceDescription:: + filter_pre (Type const&) + { + } + + void EventServiceDescription:: + filter_next (Type&) + { + } + + void EventServiceDescription:: + filter_next (Type const&) + { + } + + void EventServiceDescription:: + filter_post (Type&) + { + } + + void EventServiceDescription:: + filter_post (Type const&) + { + } + + void EventServiceDescription:: + filter_none (Type&) + { + } + + void EventServiceDescription:: + filter_none (Type const&) + { + } + + void EventServiceDescription:: id (Type& o) { dispatch (o.id ()); @@ -1771,6 +1959,7 @@ namespace CIAO traverse (Type& o) { pre (o); + name (o); type (o); source (o); if (o.id_p ()) id (o); @@ -1782,6 +1971,7 @@ namespace CIAO traverse (Type const& o) { pre (o); + name (o); type (o); source (o); if (o.id_p ()) id (o); @@ -1800,6 +1990,18 @@ namespace CIAO } void Filter:: + name (Type& o) + { + dispatch (o.name ()); + } + + void Filter:: + name (Type const& o) + { + dispatch (o.name ()); + } + + void Filter:: type (Type& o) { dispatch (o.type ()); @@ -1814,13 +2016,71 @@ namespace CIAO void Filter:: source (Type& o) { - dispatch (o.source ()); + // VC6 anathema strikes again + // + Filter::Type::source_iterator b (o.begin_source()), e (o.end_source()); + + if (b != e) + { + source_pre (o); + for (; b != e;) + { + dispatch (*b); + if (++b != e) source_next (o); + } + + source_post (o); + } } void Filter:: source (Type const& o) { - dispatch (o.source ()); + // VC6 anathema strikes again + // + Filter::Type::source_const_iterator b (o.begin_source()), e (o.end_source()); + + if (b != e) + { + source_pre (o); + for (; b != e;) + { + dispatch (*b); + if (++b != e) source_next (o); + } + + source_post (o); + } + } + + void Filter:: + source_pre (Type&) + { + } + + void Filter:: + source_pre (Type const&) + { + } + + void Filter:: + source_next (Type&) + { + } + + void Filter:: + source_next (Type const&) + { + } + + void Filter:: + source_post (Type&) + { + } + + void Filter:: + source_post (Type const&) + { } void Filter:: @@ -2246,7 +2506,6 @@ namespace CIAO namespace Config_Handlers { - namespace Writer { // EventServiceType @@ -2391,6 +2650,25 @@ namespace CIAO } void EventServiceDescription:: + filter_pre (Type const&) + { + push_ (::XSCRT::XML::Element< ACE_TCHAR > ("filter", top_ ())); + } + + void EventServiceDescription:: + filter_next (Type const& o) + { + filter_post (o); + filter_pre (o); + } + + void EventServiceDescription:: + filter_post (Type const&) + { + pop_ (); + } + + void EventServiceDescription:: id (Type const& o) { ::XSCRT::XML::Attribute< ACE_TCHAR > a ("id", "", top_ ()); @@ -2460,6 +2738,14 @@ namespace CIAO } void Filter:: + name (Type const& o) + { + push_ (::XSCRT::XML::Element< ACE_TCHAR > ("name", top_ ())); + Traversal::Filter::name (o); + pop_ (); + } + + void Filter:: type (Type const& o) { push_ (::XSCRT::XML::Element< ACE_TCHAR > ("type", top_ ())); @@ -2468,10 +2754,21 @@ namespace CIAO } void Filter:: - source (Type const& o) + source_pre (Type const&) { push_ (::XSCRT::XML::Element< ACE_TCHAR > ("source", top_ ())); - Traversal::Filter::source (o); + } + + void Filter:: + source_next (Type const& o) + { + source_post (o); + source_pre (o); + } + + void Filter:: + source_post (Type const&) + { pop_ (); } @@ -2685,7 +2982,6 @@ namespace CIAO namespace Config_Handlers { - void CIAOEvents (::CIAO::Config_Handlers::CIAOEventsDef const& s, xercesc::DOMDocument* d) { @@ -2699,6 +2995,8 @@ namespace CIAO virtual ::CIAO::Config_Handlers::Writer::EventServiceDescription, virtual ::XMLSchema::Writer::FundamentalType< ::XMLSchema::string< ACE_TCHAR >, ACE_TCHAR >, virtual ::CIAO::Config_Handlers::Writer::EventServiceType, + virtual ::CIAO::Config_Handlers::Writer::Filter, + virtual ::CIAO::Config_Handlers::Writer::FilterType, virtual ::XMLSchema::Writer::FundamentalType< ::XMLSchema::ID< ACE_TCHAR >, ACE_TCHAR >, virtual ::XSCRT::Writer< ACE_TCHAR > { diff --git a/TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAOEvents.hpp b/TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAOEvents.hpp index 147ea3a6aaf..43532de0e60 100644 --- a/TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAOEvents.hpp +++ b/TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAOEvents.hpp @@ -20,8 +20,8 @@ #endif #include "CIAO_Events_Handlers_Export.h" -#ifndef EVENT_HPP -#define EVENT_HPP +#ifndef CIAOEVENTS_HPP +#define CIAOEVENTS_HPP // Forward declarations. // @@ -49,7 +49,6 @@ namespace CIAO { namespace Config_Handlers { - class CIAO_Events_Handlers_Export EventServiceType : public ::XSCRT::Type { public: @@ -173,6 +172,21 @@ namespace CIAO protected: ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > svc_cfg_file_; + // filter + // + public: + typedef ::std::list< ::CIAO::Config_Handlers::Filter >::iterator filter_iterator; + typedef ::std::list< ::CIAO::Config_Handlers::Filter >::const_iterator filter_const_iterator; + filter_iterator begin_filter (); + filter_iterator end_filter (); + filter_const_iterator begin_filter () const; + filter_const_iterator end_filter () const; + void add_filter (::CIAO::Config_Handlers::Filter const& ); + size_t count_filter (void) const; + + protected: + ::std::list< ::CIAO::Config_Handlers::Filter > filter_; + // id // public: @@ -243,6 +257,15 @@ namespace CIAO //@@ VC6 anathema typedef ::XSCRT::Type Base__; + // name + // + public: + ::XMLSchema::string< ACE_TCHAR > const& name () const; + void name (::XMLSchema::string< ACE_TCHAR > const& ); + + protected: + ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > name_; + // type // public: @@ -255,11 +278,17 @@ namespace CIAO // source // public: - ::XMLSchema::string< ACE_TCHAR > const& source () const; - void source (::XMLSchema::string< ACE_TCHAR > const& ); + typedef ::std::list< ::XMLSchema::string< ACE_TCHAR > >::iterator source_iterator; + typedef ::std::list< ::XMLSchema::string< ACE_TCHAR > >::const_iterator source_const_iterator; + source_iterator begin_source (); + source_iterator end_source (); + source_const_iterator begin_source () const; + source_const_iterator end_source () const; + void add_source (::XMLSchema::string< ACE_TCHAR > const& ); + size_t count_source (void) const; protected: - ::std::auto_ptr< ::XMLSchema::string< ACE_TCHAR > > source_; + ::std::list< ::XMLSchema::string< ACE_TCHAR > > source_; // id // @@ -273,8 +302,8 @@ namespace CIAO ::std::auto_ptr< ::XMLSchema::ID< ACE_TCHAR > > id_; public: - Filter (::CIAO::Config_Handlers::FilterType const& type__, - ::XMLSchema::string< ACE_TCHAR > const& source__); + Filter (::XMLSchema::string< ACE_TCHAR > const& name__, + ::CIAO::Config_Handlers::FilterType const& type__); Filter (::XSCRT::XML::Element< ACE_TCHAR > const&); Filter (Filter const& s); @@ -499,12 +528,10 @@ namespace CIAO { namespace Config_Handlers { - CIAO_Events_Handlers_Export ::CIAO::Config_Handlers::CIAOEventsDef CIAOEvents (xercesc::DOMDocument const*); - } - + } } #include "XMLSchema/Traversal.hpp" @@ -513,7 +540,6 @@ namespace CIAO { namespace Config_Handlers { - namespace Traversal { typedef @@ -616,6 +642,36 @@ namespace CIAO svc_cfg_file (Type const&); virtual void + filter (Type&); + + virtual void + filter (Type const&); + + virtual void + filter_pre (Type&); + + virtual void + filter_pre (Type const&); + + virtual void + filter_next (Type&); + + virtual void + filter_next (Type const&); + + virtual void + filter_post (Type&); + + virtual void + filter_post (Type const&); + + virtual void + filter_none (Type&); + + virtual void + filter_none (Type const&); + + virtual void id (Type&); virtual void @@ -653,6 +709,12 @@ namespace CIAO pre (Type const&); virtual void + name (Type&); + + virtual void + name (Type const&); + + virtual void type (Type&); virtual void @@ -665,6 +727,24 @@ namespace CIAO source (Type const&); virtual void + source_pre (Type&); + + virtual void + source_pre (Type const&); + + virtual void + source_next (Type&); + + virtual void + source_next (Type const&); + + virtual void + source_post (Type&); + + virtual void + source_post (Type const&); + + virtual void id (Type&); virtual void @@ -879,7 +959,6 @@ namespace CIAO { namespace Config_Handlers { - namespace Writer { struct EventServiceType : Traversal::EventServiceType, @@ -1027,6 +1106,39 @@ namespace CIAO svc_cfg_file (Type const&); virtual void + filter_pre (Type &o) + { + + this->filter_pre (const_cast <Type const &> (o)); + } + + + virtual void + filter_pre (Type const&); + + virtual void + filter_next (Type &o) + { + + this->filter_next (const_cast <Type const &> (o)); + } + + + virtual void + filter_next (Type const&); + + virtual void + filter_post (Type &o) + { + + this->filter_post (const_cast <Type const &> (o)); + } + + + virtual void + filter_post (Type const&); + + virtual void id (Type &o) { @@ -1077,6 +1189,17 @@ namespace CIAO traverse (Type const&); virtual void + name (Type &o) + { + + this->name (const_cast <Type const &> (o)); + } + + + virtual void + name (Type const&); + + virtual void type (Type &o) { @@ -1088,15 +1211,37 @@ namespace CIAO type (Type const&); virtual void - source (Type &o) + source_pre (Type &o) { - this->source (const_cast <Type const &> (o)); + this->source_pre (const_cast <Type const &> (o)); } virtual void - source (Type const&); + source_pre (Type const&); + + virtual void + source_next (Type &o) + { + + this->source_next (const_cast <Type const &> (o)); + } + + + virtual void + source_next (Type const&); + + virtual void + source_post (Type &o) + { + + this->source_post (const_cast <Type const &> (o)); + } + + + virtual void + source_post (Type const&); virtual void id (Type &o) @@ -1348,13 +1493,10 @@ namespace CIAO { namespace Config_Handlers { - - CIAO_Events_Handlers_Export void CIAOEvents (::CIAO::Config_Handlers::CIAOEventsDef const&, xercesc::DOMDocument*); - } - + } } -#endif // EVENT_HPP +#endif // CIAOEVENTS_HPP diff --git a/TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAOEvents_Handler.cpp b/TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAOEvents_Handler.cpp index ffe688ffcdc..6c265bea2a5 100644 --- a/TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAOEvents_Handler.cpp +++ b/TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAOEvents_Handler.cpp @@ -48,10 +48,8 @@ namespace CIAO this->idl_esd_.reset ( new ::CIAO::DAnCE::EventServiceDeploymentDescriptions ); - CORBA::ULong num (this->idl_esd_->length ()); - this->idl_esd_->length (this->esd_->count_eventServiceConfiguration ()); - + CORBA::ULong pos_i = 0; for (CIAOEventsDef::eventServiceConfiguration_const_iterator i = this->esd_->begin_eventServiceConfiguration (); i != this->esd_->end_eventServiceConfiguration (); i++) @@ -83,8 +81,49 @@ namespace CIAO a_esd.svc_cfg_file = CORBA::string_dup (i->svc_cfg_file ().c_str ()); - (*this->idl_esd_)[num] = a_esd; - num++; + + a_esd.filters.length (i->count_filter ()); + CORBA::ULong pos_j = 0; + for (EventServiceDescription::filter_const_iterator j = i->begin_filter (); + j != i->end_filter (); + j++) + { + a_esd.filters[pos_j].name = CORBA::string_dup (j->name ().c_str ()); + switch (j->type ().integral ()) + { + case ::CIAO::Config_Handlers::FilterType::CONJUNCTION_l: + a_esd.filters[pos_j].type = CIAO::DAnCE::CONJUNCTION; + break; + case ::CIAO::Config_Handlers::FilterType::DISJUNCTION_l: + a_esd.filters[pos_j].type = CIAO::DAnCE::DISJUNCTION; + break; + case ::CIAO::Config_Handlers::FilterType::LOGICAL_AND_l: + a_esd.filters[pos_j].type = CIAO::DAnCE::LOGICAL_AND; + break; + case ::CIAO::Config_Handlers::FilterType::NEGATE_l: + a_esd.filters[pos_j].type = CIAO::DAnCE::NEGATE; + break; + default: + ACE_ERROR ((LM_ERROR, + "Invalid filter type\n")); + return false; + } + + a_esd.filters[pos_j].sources.length (j->count_source ()); + CORBA::ULong pos_k = 0; + for (Filter::source_const_iterator k = j->begin_source (); + k != j->end_source (); + k++) + { + a_esd.filters[pos_j].sources[pos_k] = CORBA::string_dup (k->c_str ()); + pos_k++; + + } + pos_j++; + } + + (*this->idl_esd_)[pos_i] = a_esd; + pos_i++; } return true; } diff --git a/TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAO_Events_Handlers.mpc b/TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAO_Events_Handlers.mpc index 09bbc4c9194..06ea67b55cc 100644 --- a/TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAO_Events_Handlers.mpc +++ b/TAO/CIAO/tools/Config_Handlers/CIAO_Events/CIAO_Events_Handlers.mpc @@ -17,4 +17,19 @@ project (CIAO_Events_Handlers) : acelib, ciao_deployment_stub, xerces { Header_Files { } -}
\ No newline at end of file +} + +project (CIAO_Events_Handlers_Tests) : ciao_component_dnc, xerces { + requires += dummy_label + exename = test + after += CIAO_Events_Handlers +// dynamicflags = CONFIG_HANDLERS_BUILD_DLL + macros += XML_USE_PTHREADS + requires += exceptions + includes += $(CIAO_ROOT)/tools/Config_Handlers + libs += CIAO_DnC_Server TAO_IFR_Client CIAO_Events_Handlers CIAO_XML_Utils + + Source_Files { + test.cpp + } +} diff --git a/TAO/CIAO/tools/Config_Handlers/CIAO_Events/test.cpp b/TAO/CIAO/tools/Config_Handlers/CIAO_Events/test.cpp new file mode 100644 index 00000000000..e80a8a7a8c4 --- /dev/null +++ b/TAO/CIAO/tools/Config_Handlers/CIAO_Events/test.cpp @@ -0,0 +1,89 @@ +// $Id$ + +#include <iostream> + +#include "CIAOEvents.hpp" +#include "CIAOEvents_Handler.h" +#include "ciao/Deployment_EventsC.h" + +#include "ace/Get_Opt.h" +#include "tao/ORB.h" + +static const char *input_file = "test.ced"; + + +static int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "i:"); + + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'i': + input_file = get_opts.opt_arg (); + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-i <input file> " + "\n", + argv [0]), + -1); + } + // Indicates sucessful parsing of the command-line + return 0; +} + +using namespace CIAO::Config_Handlers; + +int main (int argc, char *argv[]) +{ + + if (parse_args (argc, argv) != 0) + return 1; + + // Initialize an ORB so Any will work + CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv, ""); + + //Create an XML_Helper for all the file work + XML_Helper the_helper; + +// if (xercesc::DOMDocument *doc = the_helper.create_dom (input_file)) + { + //Read in the XSC type structure from the DOMDocument + //ServerResourcesDef srd = ServerResources (doc); + + CIAOEvents_Handler event_handler (input_file); + // Convert XSC to idl datatype + // SRD_Handler srd_handler (&srd); + + std::cout << "Instance document import succeeded. Dumping contents to file\n"; + + /*CIAO::DAnCE::ServerResource *sr (srd_handler.srd_idl ()); + + SRD_Handler reverse_handler (sr); + + xercesc::DOMDocument *the_xsc (the_helper.create_dom ("CIAO:ServerResources", + "http://www.dre.vanderbilt.edu/ServerResources")); + + std::cout << "NS:" + << std::string (xercesc::XMLString::transcode (the_xsc->getDocumentElement ()->getNamespaceURI ())) << std::endl + << std::string (xercesc::XMLString::transcode (the_xsc->getDocumentElement ()->getPrefix ())) << std::endl + << std::string (xercesc::XMLString::transcode (the_xsc->getDocumentElement ()->getLocalName ())) << std::endl + << std::endl; + + ServerResources (*reverse_handler.srd_xsc (), the_xsc); + + // write out the result + the_helper.write_DOM (the_xsc, "output.srd"); */ + } + + std::cout << "Test completed!"; + + return 0; + +} |