void AssemblyImpl::installComponent (Qedo_Components::Deployment::ComponentInstallation_ptr componentInstallation, HomeInstanceData data) throw( Components::CreateFailure ) { std::string package_file_ref = data.file; std::string package_file = data_.implementationMap_[package_file_ref]; std::string impl_id = data.impl_id; std::string location = std::string("PACKAGE=") + getFileName(package_file); // // install // try { DEBUG_OUT("..... install implementation "); DEBUG_OUT2(".......... destination is ", data.dest); DEBUG_OUT2(".......... implementation id is ", impl_id); DEBUG_OUT2(".......... package is ", package_file); componentInstallation->install(impl_id.c_str(), location.c_str()); } catch(Components::Deployment::InvalidLocation&) { DEBUG_OUT( ".......... upload required " ); CORBA::OctetSeq_var octSeq = new CORBA::OctetSeq(); struct stat statbuff; int rt = stat(package_file.c_str(), &statbuff); long size = statbuff.st_size; octSeq->length(size); std::ifstream package_stream(package_file.c_str(), std::ios::binary|std::ios::in); package_stream.read((char*)octSeq->get_buffer(), size); package_stream.close(); // // upload first and install afterwards // try { location = componentInstallation->upload(impl_id.c_str(), octSeq); DEBUG_OUT( ".......... upload done, install now " ); componentInstallation->install(impl_id.c_str(), location.c_str()); } catch(Components::Deployment::InstallationFailure&) { throw Components::CreateFailure(); } } catch(Components::Deployment::InstallationFailure&) { NORMAL_ERR( "AssemblyImpl: InstallationFailure during install()" ); throw Components::CreateFailure(); } catch ( CORBA::SystemException& ) { NORMAL_ERR( "AssemblyImpl: CORBA system exception during install()" ); NORMAL_ERR( "..... is ComponentInstallation running?" ); throw Components::CreateFailure(); } }
void ServerContainerInterceptor::send_other (Components::ContainerPortableInterceptor::ContainerServerRequestInfo_ptr csi) { std::cout << "COPI: send_other: " << csi->request_info()->operation(); std::cout << " for id:" << csi->component_id() << std::endl; #ifdef WIN32 org::coach::tracing::api::TraceEvent_var event = new org::coach::tracing::api::TraceEvent; // set time_stamp struct _timeb current_time; _ftime(¤t_time); CORBA::LongLong tm = current_time.time; tm = tm * 1000 + current_time.millitm; event->time_stamp = tm; // set ineraction point event->interaction_point = org::coach::tracing::api::POA_OUT_EXCEPTION; event->trail_label= CORBA::string_dup (""); unsigned long event_number = executor_ -> get_new_event_number(); char cnt[11]; sprintf (cnt, "__%08x", event_number); std::string messageid = process_id_ + cnt; event->message_id = CORBA::string_dup (messageid.c_str()); event->thread_id = CORBA::string_dup (""); event->trail_id = CORBA::string_dup (messageid.c_str()); event->event_counter = event_number; event->op_name = CORBA::string_dup (CORBA::string_dup(csi->request_info()->operation())); event->identity.object_instance_id = CORBA::string_dup (csi->name()); event->identity.object_repository_id = CORBA::string_dup ("TE"); event->identity.cmp_name = CORBA::string_dup (csi->component_id()); event->identity.cmp_type = CORBA::string_dup ("UNKNOWN_COMPONENT_TYPE"); event->identity.cnt_name = CORBA::string_dup ("UNKNOW_CONTAINER_NAME"); event->identity.cnt_type = CORBA::string_dup ("UNKONWN_CONTAINER_TYPE"); event->identity.node_name = CORBA::string_dup (hostname_.c_str()); event->identity.node_ip = CORBA::string_dup (" e"); event->identity.process_id = CORBA::string_dup (process_id_.c_str()); // Dynamic::ParameterList_var parameters = new Dynamic::ParameterList(); // parameters->length(0); event->parameters.length(0); org::coach::tracing::api::TraceEvents_var trace = new org::coach::tracing::api::TraceEvents; trace->length(1); (*trace)[0] = event; context_-> get_connection_to_trace_server() -> receiveEvent(trace.in()); CORBA::Any out_any; out_any <<= messageid.c_str(); CORBA::OctetSeq_var data = executor_ -> get_cdr_codec_ptr() -> encode_value(out_any); IOP::ServiceContext out_sc; out_sc.context_id = 100; out_sc.context_data.length(data->length()); memcpy(out_sc.context_data.get_buffer(), data->get_buffer(), data->length()); csi->request_info()->add_reply_service_context(out_sc, true); #endif }
void ReplicaController::send_reply ( PortableInterceptor::ServerRequestInfo_ptr ri) { FT::FTRequestServiceContext_var ftr ( extract_context (ri)); ACE_DEBUG ((LM_DEBUG, "(%P|%t) Sending reply for %s with rid %i\n", ftr->client_id.in (), ftr->retention_id)); // Prepare reply for logging. CORBA::Any_var result = ri->result (); TAO_OutputCDR cdr; result->impl ()->marshal_value (cdr); Dynamic::ParameterList_var pl = ri->arguments (); CORBA::ULong len = pl->length (); for (CORBA::ULong index = 0; index != len ; ++index) { //@@ No chance for PARAM_OUT if ((*pl)[index].mode == CORBA::PARAM_INOUT) { (*pl)[index].argument.impl ()->marshal_value (cdr); } } CORBA::OctetSeq_var reply; ACE_NEW (reply.out (), CORBA::OctetSeq (cdr.total_length ())); reply->length (cdr.total_length ()); CORBA::Octet* buf = reply->get_buffer (); // @@ What if this throws an exception?? We don't have any way to // check whether this succeeded for (ACE_Message_Block const* mb = cdr.begin (); mb != 0; mb = mb->cont ()) { ACE_OS::memcpy (buf, mb->rd_ptr (), mb->length ()); buf += mb->length (); } // Logging the reply and state update. // // First send message to members. // { // Extract state update. CORBA::OctetSeq_var oid = ri->object_id (); PortableInterceptor::AdapterName_var an = ri->adapter_name (); CORBA::Any_var state = ri->get_slot (state_slot_id ()); CORBA::TypeCode_var tc = state->type (); if (tc->kind () == CORBA::tk_null) { ACE_DEBUG ((LM_DEBUG, "Slot update is void\n")); PortableServer::POA_var poa = resolve_poa (an.in ()); PortableServer::ServantBase_var servant = poa->id_to_servant (oid.in ()); Checkpointable* target = dynamic_cast<Checkpointable*> (servant.in ()); if (target) { CORBA::Any_var tmp = target->get_state (); if (tmp.ptr () != 0) state = tmp._retn (); } } TAO_OutputCDR cdr; cdr << oid.in (); cdr << an.in (); cdr << ftr->client_id.in (); cdr << ftr->retention_id; cdr << reply.in (); cdr << state.in (); size_t size = cdr.total_length (); CORBA::OctetSeq_var msg; ACE_NEW (msg.out (), CORBA::OctetSeq (size)); msg->length (size); { CORBA::Octet* buf = msg->get_buffer (); for (ACE_Message_Block const* mb = cdr.begin (); mb != 0; mb = mb->cont ()) { ACE_OS::memcpy (buf, mb->rd_ptr (), mb->length ()); buf += mb->length (); } } CORBA::Octet* buf = msg->get_buffer (); // Crash point 1. // if (crash_point == 1 && ftr->retention_id > 2) ACE_OS::exit (1); try { while (true) { try { group_->send (buf, size); ACE_DEBUG ((LM_DEBUG, "Sent log record of length %i\n", size)); break; } catch (ACE_TMCast::Group::Aborted const&) { ACE_DEBUG ((LM_DEBUG, "Retrying to send log record.\n")); } } } catch (ACE_TMCast::Group::Failed const&) { ACE_DEBUG ((LM_DEBUG, "Group failure. Perhaps, I am alone in the group.\n")); } } // Now perform local logging. // RecordId rid (ftr->client_id.in (), ftr->retention_id); // This is slow but eh-safe ;-). // log_.insert (rid, reply); // Crash point 2. // if (crash_point == 2 && ftr->retention_id > 2) ACE_OS::exit (1); }