예제 #1
0
파일: server.cpp 프로젝트: CCJY/ATCD
int loadOrb(ACE_Service_Config & service_config)
{
  ACE_DEBUG ((LM_INFO, ACE_TEXT ("Loading ORB ...\n")));
  if(0 != service_config.process_directive(scpc_loadOrb))
  {
    ACE_ERROR ((LM_ERROR, ACE_TEXT ("Loading ORB failed\n")));
    return -1;
  }
  ACE_DEBUG ((LM_INFO, ACE_TEXT ("Loading ORB done.\n")));
  return 0;
}
예제 #2
0
파일: server.cpp 프로젝트: CCJY/ATCD
int
unloadNotify(ACE_Service_Config & service_config)
{
  ACE_DEBUG ((LM_INFO, ACE_TEXT ("Unloading NotifyService ...\n")));
  if(service_config.process_directive(scpc_unloadNotifyService) != 0)
  {
    ACE_ERROR ((LM_ERROR, ACE_TEXT ("Unloading NotifyService failed\n")));
    return -1;
  }
  ACE_DEBUG ((LM_INFO, ACE_TEXT ("unloading NotifyService done.\n")));
  return 0;
}
예제 #3
0
파일: server.cpp 프로젝트: CCJY/ATCD
int
loadNotify(ACE_Service_Config & service_config)
{
  try
  {
    DllOrb * p_orb = ACE_Dynamic_Service<DllOrb>::instance ("testDllOrb");
    CORBA::ORB_var v_orb = p_orb->orb();

    CORBA::Object_var v_poa = v_orb->resolve_initial_references("RootPOA");
    PortableServer::POA_var v_rootPOA = PortableServer::POA::_narrow(v_poa.in ());
    ACE_DEBUG ((LM_INFO, ACE_TEXT ("RootPOA OK.\n")));

    ACE_DEBUG ((LM_INFO, ACE_TEXT ("Loading NotifyService ...\n")));
    if(0 != service_config.process_directive(scpc_loadNotifyService))
    {
      ACE_ERROR ((LM_ERROR, ACE_TEXT ("Loading NotifyService failed\n")));
      return -1;
    }
    ACE_DEBUG ((LM_INFO, ACE_TEXT ("Loading NotifyService done.\n")));

    TAO_CosNotify_Service * p_notifyService =
      ACE_Dynamic_Service<TAO_CosNotify_Service>::instance("testNotifyService");

    p_notifyService->init_service(v_orb.in());

    CosNotifyChannelAdmin::EventChannelFactory_var v_notifyFactory =
      p_notifyService->create(
        v_rootPOA.in()
      );
    ACE_DEBUG ((LM_INFO, ACE_TEXT ("got EventChannelFactory\n")));

    // create an event channel
    CosNotifyChannelAdmin::ChannelID id;

    CosNotification::QoSProperties initialQos;
    CosNotification::AdminProperties initialAdmin;

    CosNotifyChannelAdmin::EventChannel_var v_eventChannel =
      v_notifyFactory->create_channel(
        initialQos,
        initialAdmin,
        id
      );
    ACE_DEBUG ((LM_INFO, ACE_TEXT ("got EventChannel\n")));

    CosNotifyFilter::FilterFactory_var v_filterFactory =
      v_eventChannel->default_filter_factory();
    ACE_DEBUG ((LM_INFO, ACE_TEXT ("got FilterFactory\n")));

    CosNotifyFilter::Filter_var v_filter =
      v_filterFactory->create_filter("ETCL");
    ACE_DEBUG ((LM_INFO, ACE_TEXT ("got Filter\n")));
  }
  catch(CORBA::Exception const & rc_ex)
  {
    rc_ex._tao_print_exception ("Unexpected CORBA Exception: ");
    return -1;
  }
  catch(...)
  {
    ACE_ERROR ((LM_ERROR, ACE_TEXT ("Unexpected C++ Exception\n")));
    return -1;
  }

  return 0;
}