extern "C" JNIEXPORT jboolean JNICALL Java_omnijni_ObjectImpl__1is_1a (JNIEnv* env, jclass, jlong ref, jstring jrepoId) { CORBA::Object_ptr object = reinterpret_cast<CORBA::Object_ptr>(ref); const char* repoId = env->GetStringUTFChars(jrepoId, NULL); CORBA::Boolean result = object->_is_a(repoId); env->ReleaseStringUTFChars(jrepoId, repoId); return (jboolean)result; }
CORBA::Boolean TAO_PG_ObjectGroupManager::valid_type_id ( PortableGroup::ObjectGroup_ptr object_group, TAO_PG_ObjectGroup_Map_Entry * group_entry, CORBA::Object_ptr member) { // @todo Strategize this -- e.g. strict type checking. if (CORBA::is_nil (member)) throw CORBA::BAD_PARAM (); // Before we can use this code, i.e. the reverse lock, the // TAO_PG_ObjectGroup_Entry should be made so that it is reference // counted. This is necessary since releasing the lock would // allow other threads to destroy/unbind the object group entry. // Another alternative is to simply attempt to reacquire the // object group map entry once the lock is reacquired, which is // easier to implement. // Copy the type_id before releasing the lock to avoid a race // condition. CORBA::String_var type_id = CORBA::string_dup (group_entry->type_id.in ()); CORBA::Boolean right_type_id = 0; { // Release the lock during the type_id check. No need to block // other threads during the invocation. ACE_Reverse_Lock<TAO_SYNCH_MUTEX> reverse_lock (this->lock_); ACE_GUARD_RETURN (ACE_Reverse_Lock<TAO_SYNCH_MUTEX>, reverse_guard, reverse_lock, right_type_id); // Make sure an Object of the correct type was created. It is // possible that an object of the wrong type was created if the // type_id parameter does not match the type of object the // GenericFactory creates. right_type_id = member->_is_a (type_id.in ()); } // Make sure the group entry still exists. It may have been // destroyed by another thread. (Call throws if problem.) static_cast<void> (this->get_group_entry (object_group)); return right_type_id; }
jboolean JNICALL Java_i2jrt_TAOObject__1is_1a(JNIEnv *jni, jobject jThis, jstring repoID) { JStringMgr jsm(jni, repoID); CORBA::Object_ptr ptr = recoverTaoObject(jni, jThis); try { return ptr->_is_a(jsm.c_str()); } catch (const CORBA::SystemException &se) { throw_java_exception(jni, se); } return 0; }
VALUE rCORBA_Object_is_a(VALUE self, VALUE type_id) { CORBA::Object_ptr obj; VALUE ret = Qnil; obj = r2tao_Object_r2t (self); Check_Type(type_id, T_STRING); R2TAO_TRY { int f = obj->_is_a (RSTRING(type_id)->ptr); //::printf ("rCORBA_Object_is_a: %s -> %d\n", RSTRING(type_id)->ptr, f); ret = f ? Qtrue: Qfalse; } R2TAO_CATCH; return ret; }
bool AppHelper::validate_connection (CORBA::Object_ptr obj) { for (CORBA::ULong j = 0; j != 100; ++j) { try { #if (TAO_HAS_CORBA_MESSAGING == 1) CORBA::PolicyList_var unused; obj->_validate_connection (unused); #else obj->_is_a ("Not_An_IDL_Type"); #endif /* TAO_HAS_MESSAGING == 1 */ return true; } catch (const CORBA::Exception&) { } } return false; }