Ejemplo n.º 1
0
 int setup (CORBA::ORB_ptr orb, FT_Naming::NamingManager_ptr nm)
 {
   if (group_svc.set_orb (orb) != 0 || group_svc.set_naming_manager (nm))
     {
       ACE_DEBUG ((LM_DEBUG, "Hammer setup failed\n"));
       return -1;
     }
   return 0;
 }
Ejemplo n.º 2
0
  int svc (void)
  {
    for (int g = 0, i = 0; i < 100; i++)
      {
        try {
          group_svc.member_list (group_names[g]);
        }
        catch (PortableGroup::ObjectGroupNotFound) {
          }
        catch (CORBA::Exception &ex) {
          ACE_DEBUG ((LM_DEBUG,
                      ACE_TEXT ("Hammer thread %t caught %C accessing %C\n"),
                      ex._name(), group_names[g]));
        }
        if (group_names[++g] == 0)
          g = 0;
      }

    return 0;
  }
Ejemplo n.º 3
0
int
NSGROUP::run_cmd(void)
{
  const int RC_ERROR   = -1;
  const int RC_BADARG  = -2;

  int rc = RC_ERROR;

  switch( parse_command_line () )
  {

    case NSGROUP_HELP:
      return show_usage ();
    break;

    case NSGROUP_GROUP_CREATE:
      rc = svc_.group_create ( group_arg(), policy_arg() );
    break;

    case NSGROUP_GROUP_BIND:
      rc = svc_.group_bind ( group_arg(), namepath_arg() );
    break;

    case NSGROUP_GROUP_UNBIND:
      rc = svc_.group_unbind ( namepath_arg() );
    break;

    case NSGROUP_GROUP_MODIFY:
      rc = svc_.group_modify ( group_arg(), policy_arg() );
    break;

    case NSGROUP_GROUP_LIST:
      rc = svc_.group_list ();
    break;

    case NSGROUP_GROUP_REMOVE:
      rc = svc_.group_remove ( group_arg() );
    break;

    case NSGROUP_MEMBER_LIST:
      rc = svc_.member_list ( group_arg() );
    break;

    case NSGROUP_MEMBER_ADD:
      rc = svc_.member_add ( group_arg(), location_arg(), ior_arg() );
    break;

    case NSGROUP_MEMBER_REMOVE:
      rc = svc_.member_remove ( group_arg(), location_arg() );
    break;

    case NSGROUP_MEMBER_SHOW:
      rc = svc_.member_show ( group_arg(), location_arg() );
    break;

    default:
      show_usage ();
      return rc;
    break;
  }

  if (rc == RC_BADARG)
  {
    show_usage ();
  }

  return rc;
}
Ejemplo n.º 4
0
int
NSGROUP::start_orb (void)
{
  const int RC_SUCCESS =  0;
  const int RC_ERROR   = -1;

  try
  {

#if 0
    ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("start_orb::argc(%u)\n"), this->argc_));
    for( int i = 0; i < this->argc_; ++i){
      ACE_DEBUG ((LM_DEBUG,
                  ACE_TEXT ("start_orb::argv(%u:%s)\n"),
                  i,
                  this->argv_[i]));
    }
#endif //

    // Initialise the ORB.

    CORBA::ORB_var orb_ = CORBA::ORB_init (this->argc_, this->argv_);

    if (RC_SUCCESS != svc_.set_orb (orb_.in ()))
    {

      ACE_ERROR_RETURN (( LM_ERROR,
                          ACE_TEXT (" (%P|%t) Unable to initialize the ORB.\n")),
                          RC_ERROR);
    }

    //////////////////////////////////////////////////////////////////////////
    //
    //////////////////////////////////////////////////////////////////////////
    CORBA::Object_var naming_manager_object =
      orb_->resolve_initial_references ("NamingManager");

    FT_Naming::NamingManager_var naming_manager_ =
      FT_Naming::NamingManager::_narrow (naming_manager_object.in ());

    if (RC_SUCCESS != svc_.set_naming_manager (naming_manager_.in ()))
    {
      ACE_ERROR_RETURN (( LM_ERROR,
                          ACE_TEXT (" (%P|%t) Unable to get Naming ")
                          ACE_TEXT ("Manager Reference\n")),
                        RC_ERROR);
    }
    //////////////////////////////////////////////////////////////////////////
    //
    //////////////////////////////////////////////////////////////////////////
    CORBA::Object_var naming_object =
      orb_->resolve_initial_references("NameService");

    CosNaming::NamingContextExt_var name_service_ =
      CosNaming::NamingContextExt::_narrow (naming_object.in ());

    if (RC_SUCCESS != svc_.set_name_context (name_service_.in ()))
    {
      ACE_ERROR_RETURN (( LM_ERROR,
                          ACE_TEXT (" (%P|%t) Unable to get Name Service ")
                          ACE_TEXT ("Reference\n")),
                        RC_ERROR);
    }
    //////////////////////////////////////////////////////////////////////////
    //
    //////////////////////////////////////////////////////////////////////////

  }
  catch (const CORBA::Exception& ex)
  {
    ex._tao_print_exception (ACE_TEXT("\nException raised initialising ORB\n"));
    return RC_ERROR;
  }

  return RC_SUCCESS;

}