ReqServer_ptr ReqServer::_narrow(CORBA::Object_ptr obj) { if( !obj || obj->_NP_is_nil() || obj->_NP_is_pseudo() ) return _nil(); _ptr_type e = (_ptr_type) obj->_PR_getobj()->_realNarrow(_PD_repoId); return e ? e : _nil(); }
systemCommand_ptr systemCommand::_unchecked_narrow(::CORBA::Object_ptr obj) { if( !obj || obj->_NP_is_nil() || obj->_NP_is_pseudo() ) return _nil(); _ptr_type e = (_ptr_type) obj->_PR_getobj()->_uncheckedNarrow(_PD_repoId); return e ? e : _nil(); }
jointAnglePlugin_ptr jointAnglePlugin::_unchecked_narrow(::CORBA::Object_ptr obj) { if( !obj || obj->_NP_is_nil() || obj->_NP_is_pseudo() ) return _nil(); _ptr_type e = (_ptr_type) obj->_PR_getobj()->_uncheckedNarrow(_PD_repoId); return e ? e : _nil(); }
OpenHRP::CommandReceiver_ptr OpenHRP::CommandReceiver::_narrow(::CORBA::Object_ptr obj) { if( !obj || obj->_NP_is_nil() || obj->_NP_is_pseudo() ) return _nil(); _ptr_type e = (_ptr_type) obj->_PR_getobj()->_realNarrow(_PD_repoId); return e ? e : _nil(); }
OpenHRP::PluginManager_ptr OpenHRP::PluginManager::_unchecked_narrow(::CORBA::Object_ptr obj) { if( !obj || obj->_NP_is_nil() || obj->_NP_is_pseudo() ) return _nil(); _ptr_type e = (_ptr_type) obj->_PR_getobj()->_uncheckedNarrow(_PD_repoId); return e ? e : _nil(); }
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; }
jint JNICALL Java_i2jrt_TAOObject__1hash(JNIEnv *jni, jobject jThis, jint i) { CORBA::Object_ptr ptr = recoverTaoObject(jni, jThis); try { return ptr->_hash(i); } catch (const CORBA::SystemException &se) { throw_java_exception(jni, se); } return 0; }
VALUE rCORBA_Stub_invoke(int _argc, VALUE *_argv, VALUE self) { // since rb_exc_raise () does not return and does *not* honour // C++ exception rules we invoke from an inner function and // only raise the user exception when returned so all stack // unwinding has been correctly handled. VALUE ret=Qnil; bool _raise = false; CORBA::Object_ptr obj; VALUE opname = Qnil; VALUE arg_list = Qnil; VALUE result_type = Qnil; VALUE exc_list = Qnil; VALUE v1=Qnil; // extract and check arguments rb_scan_args(_argc, _argv, "20", &opname, &v1); Check_Type (v1, T_HASH); arg_list = rb_hash_aref (v1, ID_arg_list); result_type = rb_hash_aref (v1, ID_result_type); exc_list = rb_hash_aref (v1, ID_exc_list); Check_Type(opname, T_STRING); if (arg_list != Qnil) Check_Type (arg_list, T_ARRAY); if (result_type != Qnil) r2tao_check_type(result_type, r2tao_cTypecode); if (exc_list != Qnil) Check_Type (exc_list, T_ARRAY); obj = r2tao_Object_r2t (self); R2TAO_TRY { CORBA::Request_var _req = obj->_request (RSTRING(opname)->ptr); if (arg_list != Qnil) _r2tao_set_request_arguments(_req.in (), arg_list); if (exc_list != Qnil) _r2tao_set_request_exceptions(_req.in (), exc_list); if (result_type != Qnil) _r2tao_set_request_return_type(_req.in (), result_type); ret = _r2tao_invoke_request(_req.in (), _raise); } R2TAO_CATCH; if (_raise) rb_exc_raise (ret); return ret; }
VALUE rCORBA_Object_interface_repository_id(VALUE self) { VALUE ret = Qnil; CORBA::Object_ptr obj = r2tao_Object_r2t (self); R2TAO_TRY { ret = rb_str_new2 (obj->_interface_repository_id ()); } R2TAO_CATCH; return ret; }
VALUE rCORBA_Object_hash(VALUE self, VALUE _max) { CORBA::ULong ret=0, max; CORBA::Object_ptr obj = r2tao_Object_r2t (self); max = NUM2ULONG(_max); R2TAO_TRY { ret = obj->_hash(max); } R2TAO_CATCH; return ULONG2NUM(ret); }
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; }
jboolean JNICALL Java_i2jrt_TAOObject__1is_1equivalent(JNIEnv *jni, jobject jThis, jobject jThat) { CORBA::Object_ptr ptr = recoverTaoObject(jni, jThis); CORBA::Object_ptr rhs = recoverTaoObject(jni, jThat); try { return ptr->_is_equivalent(rhs); } catch (const CORBA::SystemException &se) { throw_java_exception(jni, se); } return 0; }
jboolean JNICALL Java_i2jrt_TAOObject__1non_1existent(JNIEnv *jni, jobject jThis) { CORBA::Object_ptr ptr = recoverTaoObject(jni, jThis); try { return ptr->_non_existent(); } catch (const CORBA::SystemException &se) { throw_java_exception(jni, se); } return 0; }
TAO_BEGIN_VERSIONED_NAMESPACE_DECL CORBA::Boolean TAO_Default_Collocation_Resolver::is_collocated (CORBA::Object_ptr object) const { return object->_is_collocated (); }
CORBA::Object_ptr TAO_CEC_ProxyPushSupplier::apply_policy_obj (CORBA::Object_ptr pre) { #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 CORBA::Object_var post = CORBA::Object::_duplicate (pre); if (this->timeout_ > ACE_Time_Value::zero) { CORBA::PolicyList policy_list; policy_list.length (1); #if defined (TAO_HAS_TYPED_EVENT_CHANNEL) if (this->typed_event_channel_) { policy_list[0] = this->typed_event_channel_-> create_roundtrip_timeout_policy (this->timeout_); } else { #endif policy_list[0] = this->event_channel_-> create_roundtrip_timeout_policy (this->timeout_); #if defined (TAO_HAS_TYPED_EVENT_CHANNEL) } #endif post = pre->_set_policy_overrides (policy_list, CORBA::ADD_OVERRIDE); policy_list[0]->destroy (); policy_list.length (0); } return post._retn (); #else return CORBA::Object::_duplicate (pre); #endif /* TAO_HAS_CORBA_MESSAGING */ }
// This function does what TAO does in order to get a transport. CORBA::Boolean first_request_flag (CORBA::Object_ptr obj) { TAO_Stub *const stub = obj->_stubobj (); if (0 == stub) { ACE_ERROR_RETURN ((LM_DEBUG, "CORBA::Object has stub = 0\n"), 1); } TAO::Profile_Transport_Resolver resolver (obj, stub, true); resolver.resolve (0); TAO_Transport *transport = resolver.transport (); if (0 == transport) { ACE_ERROR_RETURN ((LM_DEBUG, "Transport is 0\n"), 1); } return transport->first_request (); }
// // handle_activate // int IOR_File_Trait:: handle_activate (::CORBA::Object_ptr obj, const ACE_CString & value) { OASIS_TAO_TRACE ("int IOR_File_Trait::handle_activate (::CORBA::Object_ptr, const ACE_CString &)"); // Get the ORB for this object. ::CORBA::ORB_var orb = obj->_get_orb (); if (::CORBA::is_nil (orb.in ())) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%T (%t) - %M - failed to resolve ORB\n")), 1); // Convert the object to a string. ::CORBA::String_var str = orb->object_to_string (obj); // Write the string to the specified file. std::ofstream file; file.open (value.c_str ()); if (!file.is_open ()) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("%T (%t) - %M - failed to open %s for writing\n"), value.c_str ()), 1); file << str.in (); file.close (); return 0; }
int insecure_invocation_test (CORBA::ORB_ptr orb, CORBA::Object_ptr obj) { // Disable protection for this insecure invocation test. Security::QOP qop = Security::SecQOPNoProtection; CORBA::Any no_protection; no_protection <<= qop; // Create the Security::QOPPolicy. CORBA::Policy_var policy = orb->create_policy (Security::SecQOPPolicy, no_protection); CORBA::PolicyList policy_list (1); policy_list.length (1); policy_list[0] = CORBA::Policy::_duplicate (policy.in ()); // Create an object reference that uses plain IIOP (i.e. no // protection). CORBA::Object_var object = obj->_set_policy_overrides (policy_list, CORBA::SET_OVERRIDE); Foo::Bar_var server = Foo::Bar::_narrow (object.in ()); if (CORBA::is_nil (server.in ())) { ACE_ERROR ((LM_ERROR, "(%P|%t) ERROR: Object reference <%s> is " "nil.\n", ior)); return 1; } try { // This invocation should result in a CORBA::NO_PERMISSION // exception. server->baz (); } catch (const CORBA::NO_PERMISSION&) { ACE_DEBUG ((LM_INFO, "(%P|%t) Received CORBA::NO_PERMISSION from " "server, as expected.\n")); return 0; } ACE_ERROR ((LM_ERROR, "(%P|%t) ERROR: CORBA::NO_PERMISSION was not thrown.\n" "(%P|%t) ERROR: It should have been thrown.\n")); return 1; }
VALUE rCORBA_Object_request(VALUE self, VALUE op_name) { CORBA::Object_ptr obj; CORBA::Request_var req; obj = r2tao_Object_r2t (self); Check_Type(op_name, T_STRING); R2TAO_TRY { req = obj->_request (RSTRING(op_name)->ptr); } R2TAO_CATCH; return r2tao_Request_t2r (req.in ()); }
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; }
// Constructor used in Thru-POA collocation code. TAO_ServerRequest::TAO_ServerRequest (TAO_ORB_Core * orb_core, TAO_Operation_Details const & details, CORBA::Object_ptr target) : mesg_base_ (0), operation_ (details.opname ()), operation_len_ (details.opname_len ()), release_operation_ (false), is_forwarded_ (false), incoming_ (0), outgoing_ (0), response_expected_ (details.response_flags () == TAO_TWOWAY_RESPONSE_FLAG || details.response_flags () == static_cast<CORBA::Octet> (Messaging::SYNC_WITH_SERVER) || details.response_flags () == static_cast<CORBA::Octet> (Messaging::SYNC_WITH_TARGET)), deferred_reply_ (false), sync_with_server_ (details.response_flags () == static_cast<CORBA::Octet> (Messaging::SYNC_WITH_SERVER)), is_queued_ (false), is_dsi_ (false), reply_status_ (GIOP::NO_EXCEPTION), orb_core_ (orb_core), request_id_ (0), profile_ (orb_core), requesting_principal_ (0), dsi_nvlist_align_ (0), operation_details_ (&details), argument_flag_ (false) #if TAO_HAS_INTERCEPTORS == 1 , interceptor_count_ (0) , rs_pi_current_ (0) , caught_exception_ (0) , pi_reply_status_ (-1) #endif /* TAO_HAS_INTERCEPTORS == 1 */ , transport_ (0) { // Have to use a const_cast<>. *sigh* this->profile_.object_key ( const_cast<TAO::ObjectKey &> (target->_stubobj ()->object_key ())); // Shallow copy the request service context list. This way the operation // details and server request share the request context. IOP::ServiceContextList & dest_request_contexts = this->request_service_context_.service_info (); IOP::ServiceContextList & src_request_contexts = (const_cast <TAO_Operation_Details&> (details)).request_service_info (); dest_request_contexts.replace (src_request_contexts.maximum (), src_request_contexts.length (), src_request_contexts.get_buffer (), false /* Do not release. */); // Don't shallow copy the reply service context. It is probably empty, // when then during the request it is used, the buffer gets allocated and // then the operation details don't get the reply service context }
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; }
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; }
// Expensive comparison of objref data, to see if two objrefs // certainly point at the same object. (It's quite OK for this to // return FALSE, and yet have the two objrefs really point to the same // object.) // // NOTE that this must NOT go across the network! // @@ Two object references are the same if any two profiles are the // same! This function is only test the profile in use!!! CORBA::Boolean TAO_Stub::is_equivalent (CORBA::Object_ptr other_obj) { if (CORBA::is_nil (other_obj)) return false; TAO_Profile * const other_profile = other_obj->_stubobj ()->profile_in_use_; TAO_Profile * const this_profile = this->profile_in_use_; if (other_profile == 0 || this_profile == 0) return false; // Compare the profiles return this_profile->is_equivalent (other_profile); }
PortableGroup::ObjectGroup_ptr TAO::FT_PG_Object_Group_Storable::add_member_to_iogr (CORBA::Object_ptr member) { // If this is the first member added to the group and it's type_id does // not match the member, then the object group should assume the same // type id as the first member. We will need to replace the object // reference with an empty reference of the specified type id. if (CORBA::is_nil (member)) {// A null object reference is not an acceptable member of the group. ORBSVCS_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) ERROR: Unable to add null member ") ACE_TEXT ("to object group with id: %s\n"), this->tagged_component_.object_group_id)); return CORBA::Object::_nil (); } const char* member_type_id = member->_stubobj ()->type_id.in (); if ((this->members_.current_size () == 0) && (ACE_OS::strcmp (this->type_id_, member_type_id) != 0) ) { try { this->type_id_ = member_type_id; this->reference_ = manipulator_.create_object_group_using_id ( this->type_id_, this->tagged_component_.group_domain_id, this->tagged_component_.object_group_id); } catch (const CORBA::Exception&) { ORBSVCS_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) ERROR: Unable to add member ") ACE_TEXT ("to object group with id: %s for object ") ACE_TEXT ("of type: %s\n"), this->tagged_component_.object_group_id, member_type_id)); return CORBA::Object::_nil (); } } return PG_Object_Group::add_member_to_iogr (member); }
CORBA::Short Activity::get_server_priority (CORBA::Object_ptr server) { // Get the Priority Model Policy from the stub. CORBA::Policy_var policy = server->_get_policy (RTCORBA::PRIORITY_MODEL_POLICY_TYPE); // Narrow down to correct type. RTCORBA::PriorityModelPolicy_var priority_policy = RTCORBA::PriorityModelPolicy::_narrow (policy.in ()); // Make sure that we have the SERVER_DECLARED priority model. RTCORBA::PriorityModel priority_model = priority_policy->priority_model (); if (priority_model != RTCORBA::SERVER_DECLARED) return -1; // Return the server priority. return priority_policy->server_priority (); }
bool cnoid::isObjectAlive(CORBA::Object_ptr obj) { bool isAlive = false; if(obj && !CORBA::is_nil(obj)){ omniORB::setClientCallTimeout(obj, 150); try { if (!obj->_non_existent()) { isAlive = true; } } catch (const CORBA::TRANSIENT &) { } catch (...) { } omniORB::setClientCallTimeout(obj, 0); } return isAlive; }
CORBA::Boolean Session_Servant_Impl_T<BASE_SKEL, EXEC, CONTEXT>::same_component ( CORBA::Object_ptr object_ref) { if (::CORBA::is_nil (object_ref)) { throw ::CORBA::BAD_PARAM (); } ::CORBA::Object_var me = this->context_->get_CCM_object (); if (::CORBA::is_nil (me.in ())) { throw ::CORBA::INTERNAL (); } ::CORBA::Object_var the_other = object_ref->_get_component (); return me->_is_equivalent (the_other.in ()); }
CORBA::Object_ptr ImR_Locator_i::set_timeout_policy (CORBA::Object_ptr obj, const ACE_Time_Value& to) { CORBA::Object_var ret (CORBA::Object::_duplicate (obj)); try { TimeBase::TimeT timeout; ORBSVCS_Time::Time_Value_to_TimeT (timeout, to); CORBA::Any tmp; tmp <<= timeout; CORBA::PolicyList policies (1); policies.length (1); policies[0] = orb_->create_policy (Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE, tmp); ret = obj->_set_policy_overrides (policies, CORBA::ADD_OVERRIDE); policies[0]->destroy (); if (CORBA::is_nil (ret.in ())) { if (debug_ > 0) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) ImR: Unable to set timeout policy.\n"))); } ret = CORBA::Object::_duplicate (obj); } } catch (const CORBA::Exception& ex) { ex._tao_print_exception ( ACE_TEXT ("(%P|%t) ImR_Locator_i::set_timeout_policy ()")); } return ret._retn (); }
void TAO::PG_Object_Group::add_member (const PortableGroup::Location & the_location, CORBA::Object_ptr member) { ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->internals_); if (CORBA::is_nil (member)) { if (TAO_debug_level > 3) { ORBSVCS_ERROR ((LM_ERROR, ACE_TEXT ("%T %n (%P|%t) - TAO::PG_Object_Group::add_member") ACE_TEXT ("Can't add a null member to object group\n") )); } throw PortableGroup::ObjectNotAdded (); } ///////////////////////////////////////// // Convert the new member to a string IOR // This keeps a clean IOR (not an IOGR!) // while we add it to a group. We need a // IORs, not IOGRs to send new IOGRs out // to replicas. // Verify that the member is not using V1.0 profiles // since IIOP V1.0 does not support tagged components const TAO_MProfile &member_profiles = member->_stubobj ()->base_profiles (); CORBA::ULong member_profile_count = member_profiles.profile_count (); if (member_profile_count > 0) { const TAO_GIOP_Message_Version & version = member_profiles.get_profile (0)->version (); if (version.major_version () == 1 && version.minor_version () == 0) { if (TAO_debug_level > 3) { ORBSVCS_ERROR ((LM_ERROR, ACE_TEXT ("%T %n (%P|%t) - ") ACE_TEXT ("Can't add member because first profile ") ACE_TEXT ("is IIOP version 1.0, which does not ") ACE_TEXT ("support tagged components.\n") )); } throw PortableGroup::ObjectNotAdded (); } } CORBA::String_var member_ior_string = orb_->object_to_string (member); PortableGroup::ObjectGroup_var new_reference; try { new_reference = this->add_member_to_iogr (member); } catch (const TAO_IOP::Duplicate&) { throw PortableGroup::MemberAlreadyPresent (); } catch (const TAO_IOP::Invalid_IOR&) { throw PortableGroup::ObjectNotAdded (); } catch (...) { throw; } if (CORBA::is_nil (new_reference.in ())) throw PortableGroup::ObjectNotAdded (); // Convert new member back to a (non group) ior. CORBA::Object_var member_ior = this->orb_->string_to_object (member_ior_string.in ()); MemberInfo * info = 0; ACE_NEW_THROW_EX (info, MemberInfo (member_ior.in (), the_location), CORBA::NO_MEMORY()); if (this->members_.bind (the_location, info) != 0) { delete info; // @@ Dale why this is a NO MEMORY exception? throw CORBA::NO_MEMORY(); } this->reference_ = new_reference; // note var-to-var assignment does // a duplicate if (this->increment_version ()) { this->distribute_iogr (); } else { // Issue with incrementing the version if (TAO_debug_level > 6) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("PG (%P|%t) Issue incrementing the ") ACE_TEXT ("version in Object_Group add_member\n"))); } // Must unbind the new member and delete it. if (this->members_.unbind (the_location, info) == 0) delete info; throw PortableGroup::ObjectNotAdded (); } if (TAO_debug_level > 6) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT("PG (%P|%t) exit Object_Group add_member\n"))); } }