예제 #1
0
PortableServer::POA_ptr
init_orb (int argc,
          ACE_TCHAR **argv,
          const char *orb_name,
          CORBA::ORB_ptr &orb_ptr)
{
  // Initialize the ORB first.
  CORBA::ORB_var orb = CORBA::ORB_init (argc,
                                        argv,
                                        orb_name);

  // Obtain the RootPOA.
  CORBA::Object_var obj =
    orb->resolve_initial_references ("RootPOA");

  // Get the POA_var object from Object_var.
  PortableServer::POA_var root_poa =
    PortableServer::POA::_narrow (obj.in ());

  // Get the POAManager of the RootPOA.
  PortableServer::POAManager_var poa_manager =
    root_poa->the_POAManager ();

  poa_manager->activate ();

  orb_ptr = orb._retn ();
  return root_poa._retn ();
}
예제 #2
0
jobject JNICALL Java_i2jrt_ORB_init(JNIEnv *jni, jclass clazz,
                                    jobject ssholder, jstring orbId)
{
  JniArgv jargv(jni, ssholder);
  JStringMgr jsm_orbId(jni, orbId);

  CORBA::ORB_var orb;

  try {
    orb = CORBA::ORB_init(jargv.argc_, jargv.orb_argv(),
                          jsm_orbId.c_str());

  } catch (const CORBA::SystemException &se) {
    se._tao_print_exception("I2JRT ORB_init:");
    throw_java_exception(jni, se);
    return 0;
  }

  jmethodID ctor = jni->GetMethodID(clazz, "<init>", "(J)V");
  assert(ctor);
  return jni->NewObject(clazz, ctor, reinterpret_cast<jlong>(orb._retn()));
}