Exemplo n.º 1
0
// Bind the handler with the request id.
int
TAO_Exclusive_TMS::bind_dispatcher (CORBA::ULong request_id,
                                    ACE_Intrusive_Auto_Ptr<TAO_Reply_Dispatcher> rd)
{
    this->request_id_ = request_id;
    this->rd_ = rd.get ();

    return 0;
}
Exemplo n.º 2
0
int
testSeparation (int , ACE_TCHAR *[])
{
  ACE_TRACE ("testSeparation");

  ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> one (new ACE_Service_Gestalt_Test (10));
  one->process_directive (ace_svc_desc_TAO_CORBANAME_Parser);

  ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> two (new ACE_Service_Gestalt_Test (10));
  two->process_directive (ace_svc_desc_TAO_CORBALOC_Parser);

  const ACE_TCHAR *svcname = ACE_TEXT ("IIOP_Factory");

  TAO_Protocol_Factory* p10 = ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (one.get (), svcname);
  if (p10 != 0)
    ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Not expected %s locally in one\n"), svcname), -1);

  TAO_Protocol_Factory* p11 =  ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (two.get (), "IIOP_Factory");
  if (p11 != 0)
    ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Not expected %s locally in two\n"), svcname), -1);

  svcname = ACE_TEXT ("CORBANAME_Parser");

  ACE_Service_Object* p20 =  ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), svcname);
  if (p20 == 0)
    ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected %s locally, in one\n"), svcname), -1);

  ACE_Service_Object* p31 = ACE_Dynamic_Service<ACE_Service_Object>::instance (two.get (), svcname);
  if (p31 != 0)
    ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Not expected %s locally, in two\n"), svcname), -1);

  svcname = ACE_TEXT ("CORBALOC_Parser");

  ACE_Service_Object* p21 =  ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), svcname);
  if (p21 != 0)
    ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Not expected %s locally, in one\n"), svcname), -1);

  ACE_Service_Object* p30 = ACE_Dynamic_Service<ACE_Service_Object>::instance (two.get (), svcname);
  if (p30 == 0)
    ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected %s locally, in two\n"), svcname), -1);

  return 0;
}
Exemplo n.º 3
0
int
ACE_TMAIN (int, ACE_TCHAR *[])
{
  ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> one (new ACE_Service_Gestalt());

  one->process_directive (ace_svc_desc_TAO_CORBANAME_Parser);
  one->process_directive (ace_svc_desc_TAO_CORBALOC_Parser);

  TAO_Protocol_Factory* p1 = ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (one.get (), "IIOP_Factory");

  if (p1 != 0)
      ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Unexpected to find IIOP_Factory\n")), -1);

  ACE_Service_Object* p2 = ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), "CORBANAME_Parser");

  if (p2 == 0)
      ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected to find CORBANAME_Parser\n")), -1);

  ACE_Service_Object* p3 = ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), "CORBALOC_Parser");

  if (p3 == 0)
      ACE_ERROR_RETURN ((LM_DEBUG, ACE_TEXT("Expected to find CORBALOC_Parser\n")), -1);

  return 0;
}
Exemplo n.º 4
0
int
TAO_Exclusive_TMS::dispatch_reply (TAO_Pluggable_Reply_Params &params)
{
    // Check the ids.
    if (!this->rd_ || this->request_id_ != params.request_id_)
    {
        if (TAO_debug_level > 0)
            TAOLIB_DEBUG ((LM_DEBUG,
                           ACE_TEXT ("TAO (%P|%t) - Exclusive_TMS::dispatch_reply - <%d != %d>\n"),
                           this->request_id_, params.request_id_));

        // The return value 0 informs the transport that the mux strategy
        // did not find the right reply handler.
        return 0;
    }

    ACE_Intrusive_Auto_Ptr<TAO_Reply_Dispatcher> rd (this->rd_.get ());
    this->request_id_ = 0; // @@ What is a good value???
    this->rd_.release ();

    // Dispatch the reply.
    // Returns 1 on success, -1 on failure.
    return rd->dispatch_reply (params);
}
Exemplo n.º 5
0
int
TAO_Exclusive_TMS::reply_timed_out (CORBA::ULong request_id)
{
    // Check the ids.
    if (!this->rd_ || this->request_id_ != request_id)
    {
        if (TAO_debug_level > 0)
            TAOLIB_DEBUG ((LM_DEBUG,
                           ACE_TEXT ("TAO (%P|%t) - Exclusive_TMS::reply_timed_out - <%d != %d>\n"),
                           this->request_id_, request_id));

        // The return value 0 informs the transport that the mux strategy
        // did not find the right reply handler.
        return 0;
    }

    ACE_Intrusive_Auto_Ptr<TAO_Reply_Dispatcher> rd (this->rd_.get ());
    this->request_id_ = 0; // @@ What is a good value???
    this->rd_.release ();

    rd->reply_timed_out ();

    return 0;
}
Exemplo n.º 6
0
int
main(int argc, char *argv[])
{
  try {      
    // configure log verbosity globally
    // setting global default configuration file
    // parse robot (and CORBA) command-line parameters
    Miro::Robot::init(argc, argv);
 
    // overwrite DDS global defaults
    kn::DdsEntitiesFactorySvcParameters * ddsEntitiesParams = 
      kn::DdsEntitiesFactorySvcParameters::instance();
    
    // alter default parameters
    ddsEntitiesParams->defaultLibrary = "RapidQosLibrary";

    // configure DDS global setting
    kn::DdsSupport::init(argc, argv);


    // Hardcode participant name and participant Qos Profile
    ddsEntitiesParams->participants[0].participantName = "ProcessManager";
    ddsEntitiesParams->participants[0].profile = "RapidDefaultQos";

    // configure DDS global setting
    kn::DdsEntitiesFactorySvc ddsFactory;
    if (ddsFactory.init(ddsEntitiesParams) != 0)
      return -1;
    
    if (parseArgs(argc, argv) != 0)
      return -1;

    // somehow we miss the static includes otherwise
    ACE_Service_Config::open("rctld", 0, false);
    {
      ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> svcs = new ACE_Service_Gestalt(1024, true, false);

      string procCmd = "static ProcessManagerSvc \"" + procDirective + "\"";
      if (svcs->process_directive(procCmd.c_str()) != 0) {
        return 1;
      }

      if (systemInfo) {
        string sysInfoCmd = "static SystemInfoSvc \"" + sysInfoDirective + "\"";
        if (svcs->process_directive(sysInfoCmd.c_str()) != 0) {
          return 1;
        }
      }
    
      if (cmdMgr) {
        string cmdMgrCmd = "static CommandManagerSvc \"" + commandManagerDirective + "\"";
        if (svcs->process_directive(cmdMgrCmd.c_str()) != 0) {
          return 1;
        }
      }
    
      MIRO_LOG(LL_NOTICE, "Entering server loop.");
      Miro::ShutdownHandler shutdownHandler;
      while(!shutdownHandler.isShutdown()) {
        kn::this_thread::sleep_for(kn::microseconds(100000));
      }
      MIRO_LOG(LL_NOTICE, "End of server loop.");
    }
    ddsFactory.fini();

    MIRO_LOG(LL_NOTICE, "End of main server scope.");
  }
  catch (Miro::Exception const& e) {
    MIRO_LOG_OSTR(LL_CRITICAL, "Miro exception:\n" << e);
  }
  catch (std::exception const& e) {
    MIRO_LOG_OSTR(LL_CRITICAL, "Unexpected std-exception\n" << e.what());
  }
  catch (...) {
    MIRO_LOG_OSTR(LL_CRITICAL, "Unexpected exception\n");
  }
  
  MIRO_LOG(LL_NOTICE, "bye");
  return 0;
}
Exemplo n.º 7
0
int
main(int argc, char *argv[])
{
  try {      
    // configure log verbosity globally
    // setting global default configuration file
    // parse robot (and CORBA) command-line parameters
    // create top-level server instance
    // configure ORB parameters globally
    Miro::Log::init(argc, argv);

    //    Miro::Server server(argc, argv);

    // overwrite DDS global defaults
    kn::DdsEntitiesFactorySvcParameters * ddsEntitiesParams = 
      kn::DdsEntitiesFactorySvcParameters::instance();
    
    // alter default parameters
    ddsEntitiesParams->defaultLibrary = "RapidQosLibrary";

    // configure DDS global setting
    kn::DdsSupport::init(argc, argv);

    // Hardcode participant name and participant Qos Profile
    ddsEntitiesParams->participants[0].participantName = "RapidExec";
    ddsEntitiesParams->participants[0].profile = "RapidDefaultQos";

    // configure DDS global setting
    kn::DdsEntitiesFactorySvc ddsFactory;
    if (ddsFactory.init(ddsEntitiesParams) != 0)
      return -1;
    
    if (parseArgs(argc, argv) != 0)
      return -1;


    ACE_Service_Config::open("CommandManagerSvc", 0, false);
    {
      ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> svcs = new ACE_Service_Gestalt(1024, true, false);

            // sequencer
      string sequencerSvc = "static CommandManagerSvc \"" + sequencerDirective + "\"";
      // string sequencerSvc = "dynamic CommandManagerSvc Service_Object * rapidCommanding:_make_rapid_CommandManagerSvc() \"" + sequencerDirective + "\"";
      if (svcs->process_directive(sequencerSvc.c_str()) != 0) {
        return 1;
      }
      
      MIRO_LOG(LL_NOTICE, "Entering server loop.");
      Miro::ShutdownHandler shutdownHandler;
      while(!shutdownHandler.isShutdown()) {
        kn::this_thread::sleep_for(kn::microseconds(100000));
      }
      MIRO_LOG(LL_NOTICE, "End of server loop.");
    }
    ddsFactory.fini();

    MIRO_LOG(LL_NOTICE, "End of main server scope.");
  }
  catch (std::exception const& e) {
    MIRO_LOG_OSTR(LL_CRITICAL, "Unexpected std-exception\n" << e.what());
  }
  catch (...) {
    MIRO_LOG_OSTR(LL_CRITICAL, "Unexpected exception\n");
  }

  MIRO_LOG(LL_NOTICE, "bye");
  return 0;
}
Exemplo n.º 8
0
int
testReusingGlobals (int , ACE_TCHAR *[])
{
  ACE_TRACE ("testReusingGlobals");

  {
    ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> one (new ACE_Service_Gestalt (10, false));

    // The ACE_Service_Gestalt_Test will teardown all!
    one->process_directive (ace_svc_desc_TAO_CORBANAME_Parser);
    one->process_directive (ace_svc_desc_TAO_CORBALOC_Parser);

    const ACE_TCHAR *svcname = ACE_TEXT ("IIOP_Factory");
    TAO_Protocol_Factory* p1 = ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (one.get (), svcname);

    if (p1 != 0)
      {
        ACE_ERROR ((LM_ERROR, ACE_TEXT ("Not expected to find %s locally\n"), svcname));
        return -1;
      }

    svcname = ACE_TEXT ("CORBANAME_Parser");
    ACE_Service_Object* p2 = ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), svcname);

    if (p2 == 0)
      {
        ACE_ERROR ((LM_ERROR, ACE_TEXT ("Expected to find %s localy\n"), svcname));
        return -1;
      }

    svcname = ACE_TEXT ("CORBALOC_Parser");
    ACE_Service_Object* p3 = ACE_Dynamic_Service<ACE_Service_Object>::instance (one.get (), svcname);

    if (p3 == 0)
      {
        ACE_ERROR ((LM_ERROR, ACE_TEXT ("Expected to find %s locally\n"), svcname));
        return -1;
      }
  }


  ACE_Intrusive_Auto_Ptr<ACE_Service_Gestalt> two (new ACE_Service_Gestalt_Test (10));
  //  ACE_Service_Gestalt_Test two; // Use the ACE_Service_Repository::instance ()

  const ACE_TCHAR *svcname = ACE_TEXT ("IIOP_Factory");
  TAO_Protocol_Factory* p1 = ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (two.get (), svcname);

  if (p1 != 0)
    {
      ACE_ERROR ((LM_ERROR, ACE_TEXT ("Not expected to find %s in the global repo\n"), svcname));
      return -1;
    }

  svcname = ACE_TEXT ("CORBANAME_Parser");
  ACE_Service_Object* p2 = ACE_Dynamic_Service<ACE_Service_Object>::instance (two.get (), svcname);

  if (p2 == 0) // You should be able to find the same stuff here, too
    {
      ACE_ERROR ((LM_ERROR, ACE_TEXT ("Not expected to find %s in the global repo\n"), svcname));
      return -1;
      }

  return 0;
}