00001 // $Id: ETCL_FilterFactory.cpp 80974 2008-03-17 13:40:44Z johnnyw $ 00002 00003 #include "orbsvcs/Notify/ETCL_FilterFactory.h" 00004 00005 ACE_RCSID(Notify, TAO_Notify_ETCL_FilterFactory, "$Id: ETCL_FilterFactory.cpp 80974 2008-03-17 13:40:44Z johnnyw $") 00006 00007 #include "orbsvcs/Notify/ETCL_Filter.h" 00008 00009 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00010 00011 TAO_Notify_ETCL_FilterFactory::TAO_Notify_ETCL_FilterFactory (void) : 00012 filter_poa_ (PortableServer::POA::_nil ()) 00013 { 00014 } 00015 00016 TAO_Notify_ETCL_FilterFactory::~TAO_Notify_ETCL_FilterFactory () 00017 { 00018 } 00019 00020 CosNotifyFilter::FilterFactory_ptr 00021 TAO_Notify_ETCL_FilterFactory::create (PortableServer::POA_ptr filter_poa) 00022 { 00023 this->filter_poa_ = PortableServer::POA::_duplicate(filter_poa); // save the filter poa. 00024 00025 PortableServer::ServantBase_var servant_var (this); 00026 00027 PortableServer::ObjectId_var id = filter_poa->activate_object (this); 00028 00029 CORBA::Object_var object = filter_poa->id_to_reference (id.in ()); 00030 00031 CosNotifyFilter::FilterFactory_var filter = CosNotifyFilter::FilterFactory::_narrow (object.in ()); 00032 00033 return filter._retn(); 00034 } 00035 00036 CosNotifyFilter::Filter_ptr 00037 TAO_Notify_ETCL_FilterFactory::create_filter (const char *constraint_grammar) 00038 { 00039 // @@: change to "ExTCL" later. 00040 if (ACE_OS::strcmp (constraint_grammar, "TCL") != 0 && 00041 ACE_OS::strcmp (constraint_grammar, "ETCL") != 0 && 00042 ACE_OS::strcmp (constraint_grammar, "EXTENDED_TCL") != 0) 00043 throw CosNotifyFilter::InvalidGrammar (); 00044 00045 // Create the RefCounted servant. 00046 TAO_Notify_ETCL_Filter* filter = 0; 00047 00048 ACE_NEW_THROW_EX (filter, 00049 TAO_Notify_ETCL_Filter (this->filter_poa_.in ()), 00050 CORBA::NO_MEMORY ()); 00051 00052 PortableServer::ServantBase_var filter_var (filter); 00053 00054 PortableServer::ObjectId_var oid = 00055 this->filter_poa_->activate_object (filter); 00056 00057 CORBA::Object_var obj = 00058 this->filter_poa_->id_to_reference (oid.in ()); 00059 00060 return CosNotifyFilter::Filter::_narrow (obj.in ()); 00061 } 00062 00063 CosNotifyFilter::MappingFilter_ptr 00064 TAO_Notify_ETCL_FilterFactory::create_mapping_filter (const char * /*constraint_grammar*/, 00065 const CORBA::Any & /*default_value*/) 00066 { 00067 throw CORBA::NO_IMPLEMENT (); 00068 } 00069 00070 TAO_END_VERSIONED_NAMESPACE_DECL 00071 00072 ACE_FACTORY_DEFINE (TAO_Notify_Serv, TAO_Notify_ETCL_FilterFactory)