Esempio n. 1
0
void
test_get_servant_with_no_set (PortableServer::POA_ptr poa)
{
  bool succeed = false;
  try
    {
      // Getting the default servant without one set whould give a NoServant
      // exception
      PortableServer::Servant servant =
        poa->get_servant ();

      ACE_UNUSED_ARG (servant);
    }
  catch (const PortableServer::POA::NoServant& )
    {
      succeed = true;
    }
  catch (const CORBA::Exception&)
    {
    }

  if (!succeed)
  {
    ACE_ERROR ((LM_ERROR,
                "(%t) ERROR, get servant without one set failed\n"));
  }
}
Esempio n. 2
0
CosNotifyFilter::MappingFilter_ptr 
FilterFactoryImpl::create_mapping_filter(const char* constraint_grammar, 
                                         const CORBA::Any& default_value)
  throw (CosNotifyFilter::InvalidGrammar)
{
  
  FilterFactoryImpl::CREATE_MAPPING_FILTER[1] = constraint_grammar;

  if (_tidorb->trace != NULL)
      _tidorb->print_trace(TIDorb::util::TR_USER, 
                           "FilterFactoryImpl::crete_mapping_filter");

  PortableServer::POA_ptr poa = globalMappingDiscriminatorPOA();
  TIDorb::util::StringBuffer buffer_id;
  try {
    if (PersistenceManager::isActive())
      buffer_id << PersistenceManager::getDB()->getUID();
    else
      buffer_id << "0";
  }
  catch (const CORBA::Exception& e1) {
    if (_tidorb->trace != NULL)
      _tidorb->print_trace(TIDorb::util::TR_ERROR, 
                           "FilterFactoryImpl::crete_mapping_filter Persistence Manager failed", 
                           e1);
    throw CORBA::INTERNAL("Persistence Manager failed");
  }
  MappingFilterData* filterData = new MappingFilterData(buffer_id.str().data(), 
                                                        default_value);
  
  try {
    (dynamic_cast<MappingFilterImpl*> (poa->get_servant()))->register_data( filterData );
  } 
  catch (const CORBA::Exception& e) {
  }
  
  if (PersistenceManager::isActive()) {
    PersistenceManager::getDB()->save_data( filterData );
    PersistenceManager::getDB()->update_data(PersistenceDB::ATTR_DISCRIMINATOR, 
                                             filterData);
  }
  
  return NotifReference::mappingDiscriminatorReference(filterData->poa,
                                                       filterData->id);
  
}
Esempio n. 3
0
CosNotifyFilter::Filter_ptr 
FilterFactoryImpl::create_filter(const char* constraint_grammar)
  throw (CosNotifyFilter::InvalidGrammar)
{

  FilterFactoryImpl::CREATE_FILTER[1] = constraint_grammar;
		

  if (_tidorb->trace != NULL)
    _tidorb->print_trace(TIDorb::util::TR_USER, 
                         "FilterFactoryImpl::crete_filter ");
			
  if (strcmp(constraint_grammar, util::parser::TIDParser::_CONSTRAINT_GRAMMAR)) 
  {
    throw CosNotifyFilter::InvalidGrammar();
  }
  PortableServer::POA_ptr poa = globalFilterPOA();
  TIDorb::util::StringBuffer buffer_id;
  try {
    if (PersistenceManager::isActive())
      buffer_id << PersistenceManager::getDB()->getUID();
    else
      buffer_id << "0";
  }
  catch (const CORBA::Exception& e1) {
    if (_tidorb->trace != NULL)
      _tidorb->print_trace(TIDorb::util::TR_ERROR, 
                           "FilterFactoryImpl::crete_filter Persistence Manager failed", e1);
    throw CORBA::INTERNAL("Persistence Manager failed");
  }
  FilterData* filterData = new FilterData(buffer_id.str().data(), poa);

  try {
    (dynamic_cast<FilterImpl*> (poa->get_servant()))->register_data( filterData );
  } catch (CORBA::Exception& e) {}

  if (PersistenceManager::isActive()) {
    (PersistenceManager::getDB())->save_data( filterData );
    (PersistenceManager::getDB())->update_data(PersistenceDB::ATTR_DISCRIMINATOR, 
                                               filterData);
  }
  
  return NotifReference::discriminatorReference(filterData->poa,
                                                filterData->id);
}