void TAO_Notify_Tests_Filter_Command::handle_destroy_filter (void) { CosNotifyFilter::Filter_var filter; LOOKUP_MANAGER->resolve (filter, this->name_.c_str ()); filter->destroy (); }
//----------------------------------------------------------------------------- int Consumer::addFilter(const char* type_name, const char* filterString) { ACS_TRACE("Consumer::addFilter"); try { //Create a temporary filter factory CosNotifyFilter::FilterFactory_var filterFactory = notifyChannel_m->default_filter_factory(); if(CORBA::is_nil(filterFactory.in()) == true) { CORBAProblemExImpl err = CORBAProblemExImpl(__FILE__,__LINE__,"nc::Consumer::addFilter"); throw err.getCORBAProblemEx(); } //Create a filter CosNotifyFilter::Filter_var filter = 0; filter = filterFactory->create_filter(getFilterLanguage()); if(filter.in() == 0) { CORBAProblemExImpl err = CORBAProblemExImpl(__FILE__,__LINE__,"nc::Consumer::addFilter"); throw err.getCORBAProblemEx(); } //Create the constraint expression sequence CosNotifyFilter::ConstraintExpSeq cexp(1); cexp.length(1); cexp[0].event_types.length(1); cexp[0].event_types[0].domain_name = getChannelDomain(); cexp[0].event_types[0].type_name = CORBA::string_dup(type_name); cexp[0].constraint_expr = CORBA::string_dup(filterString); try { filter->add_constraints(cexp); } catch(CosNotifyFilter::InvalidConstraint e) { if (filter.in() != 0) { filter->destroy(); filter = 0; } ACS_SHORT_LOG((LM_ERROR,"Consumer::addFilter failed for the '%s' channel, '%s' event type, and '%s' filter!", channelName_mp, type_name, filterString)); CORBAProblemExImpl err = CORBAProblemExImpl(__FILE__,__LINE__,"nc::Consumer::addFilter"); throw err.getCORBAProblemEx(); } return proxySupplier_m->add_filter(filter._retn()); } catch(CORBAProblemEx) { ACS_SHORT_LOG((LM_TRACE,"Consumer::addFilter failed for the '%s' channel, '%s' event type, and '%s' filter with a nil pointer!", channelName_mp, type_name, filterString)); throw; } catch(...) { ACS_SHORT_LOG((LM_ERROR,"Consumer::addFilter failed for the '%s' channel, '%s' event type, and '%s' filter!", channelName_mp, type_name, filterString)); CORBAProblemExImpl err = CORBAProblemExImpl(__FILE__,__LINE__,"nc::Consumer::addFilter"); throw err.getCORBAProblemEx(); } }