bool UDPSourceTransportEndpoint::send_buffer (StreamComponents::StreamingBuffer_ptr buffer) { DEBUG_OUT ("UDPSourceTransportEndpoint: send_buffer() called"); // Test whether we must fragment, TODO // We do a copy here, there are solutions to avoid this copy and have zero-copy send semantics CORBA::ULong buf_size = buffer->get_used() + sizeof (StreamComponents::UDPProfileHeader); char* buf = (char*)malloc (buf_size); ((StreamComponents::UDPProfileHeader*)buf)->stream_number = htons (current_stream_number_); ((StreamComponents::UDPProfileHeader*)buf)->seq_length = htonl (buffer->get_used()); ((StreamComponents::UDPProfileHeader*)buf)->fragment_number = 0; ((StreamComponents::UDPProfileHeader*)buf)->last_fragment_number = 0; memcpy (buf + sizeof (StreamComponents::UDPProfileHeader), buffer->get_buffer(), buffer->get_used()); #ifdef _WIN32 if (sendto (socket_, buf, buf_size, 0, (const sockaddr*)&sink_sock_addr_, sizeof (sink_sock_addr_)) == SOCKET_ERROR) #else if (sendto (socket_, buf, buf_size, 0, (const sockaddr*)&sink_sock_addr_, sizeof (sink_sock_addr_)) == -1) #endif { DEBUG_OUT ("UDPSourceTransportEndpoint: send_buffer(): Could not send packet"); #ifdef _WIN32 DEBUG_OUT2 ("UDPSourceTransportEndpoint: error code was ", WSAGetLastError()); #else DEBUG_OUT2 ("UDPSourceTransportEndpoint: error code was ", errno); #endif this->close(); return false; } return true; }
DCI::AssemblyUUIDs* RepDCIManagerSessionImpl::get_assemblies() throw(CORBA::SystemException) { // BEGIN USER INSERT SECTION RepDCIManagerSessionImpl::get_assemblies /* * Retrieve the list of all installed assemblies. */ DEBUG_OUT( "RepDCIManagerSessionImpl::get_assemblies(): start..."); //get connection to repository MDE::Deployment::AssemblyClass_var ass_ref = this->get_rep_root()->assembly_ref(); if ( CORBA::is_nil ( ass_ref ) ) { NORMAL_ERR("RepDCIManagerSessionImpl::get_assemblies(): AssemblyClass reference nil!"); throw CORBA::SystemException(); } DCI::AssemblyUUIDs_var ret = new DCI::AssemblyUUIDs(); //get all assemblies MDE::Deployment::AssemblySet_var set_ = ass_ref->all_of_class_assembly(); for (unsigned long idx = 0; idx < set_->length(); idx++ ) { if((*set_)[idx]->valid()) { ret->length(ret->length()+1); (*ret)[ret->length()-1] = (*set_)[idx]->uuid(); DEBUG_OUT2(" add uuid=", (*set_)[idx]->uuid()); } else DEBUG_OUT2(" invalid uuid=", (*set_)[idx]->uuid()); } DEBUG_OUT( "RepDCIManagerSessionImpl::get_assemblies(): ...end"); return ret._retn(); // END USER INSERT SECTION RepDCIManagerSessionImpl::get_assemblies }
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(); } }
Qedo_Components::Deployment::ComponentInstallation_ptr AssemblyImpl::getComponentInstallation(std::string host) throw( Components::CreateFailure ) { Qedo_Components::Deployment::ComponentInstallation_var componentInstallation; CORBA::Object_var obj; // // get ComponentInstallation for destination // obj = resolveName(COMPONENT_INSTALLATION_CONTEXT + host); if ( CORBA::is_nil(obj)) { DEBUG_OUT2("..... no Object for ", host); throw Components::CreateFailure(); } componentInstallation = Qedo_Components::Deployment::ComponentInstallation::_narrow(obj.in()); if ( CORBA::is_nil(componentInstallation.in())) { DEBUG_OUT2("..... no ComponentInstallation for ", host); throw Components::CreateFailure(); } return componentInstallation._retn(); }
Cookie_impl* ReceptaclePort::add_connection (CORBA::Object_ptr connection) throw (Components::InvalidConnection, Components::AlreadyConnected, Components::ExceededConnectionLimit) { // Test whether already connected if ( !is_multiplex_ && connections_.size() > 0 ) { DEBUG_OUT2 ("ReceptaclePort: Multiple connections not allowed for receptacle ", port_name_); throw Components::AlreadyConnected(); } // Test for type of connection if (! connection->_is_a (type_id_.c_str())) { DEBUG_OUT2 ( "ReceptaclePort: Connection has wrong type for receptacle ", port_name_ ); throw Components::InvalidConnection(); } // Create cookie Cookie_impl* new_cookie = new Cookie_impl(); // Create connection entry ReceptacleConnection new_entry (connection, new_cookie); connections_.push_back (new_entry); return new_cookie; }
DCI::InstanceUUIDs* RepDCIManagerSessionImpl::get_assembly_instances(const char* assemblyUUID) throw(CORBA::SystemException, ::DCI::UnknownAssembly) { // BEGIN USER INSERT SECTION RepDCIManagerSessionImpl::get_assembly_instances /* * Retrieve list of all instances of an assembly. */ DEBUG_OUT2( "RepDCIManagerSessionImpl::get_assembly_instances(): start... assemblyUUID=", assemblyUUID); //lookup assembly MDE::Deployment::Assembly_var ass; try { ass = this->get_assembly(assemblyUUID); } catch(...){ throw ::DCI::CreationFailure(); } DCI::InstanceUUIDs_var ret = new DCI::InstanceUUIDs(); //get all AssemblyInstances MDE::Deployment::AssemblyInstanceSet_var set_ = ass->ass_inst(); for (unsigned long idx = 0; idx < set_->length(); idx++ ) { if((*set_)[idx]->valid()) { ret->length(ret->length()+1); (*ret)[ret->length()-1] = (*set_)[idx]->id(); DEBUG_OUT2(" add id=", (*set_)[idx]->id()); } else DEBUG_OUT2(" invalid id=", (*set_)[idx]->id()); } DEBUG_OUT( "RepDCIManagerSessionImpl::get_assembly_instances(): ...end"); return ret._retn(); // END USER INSERT SECTION RepDCIManagerSessionImpl::get_assembly_instances }
void AssemblyImpl::uninstall () throw( Components::CreateFailure ) { Qedo_Components::Deployment::ComponentInstallation_var componentInstallation; // // for each hostcollocation // std::vector < HostData > ::const_iterator host_iter; for(host_iter = data_.hosts_.begin(); host_iter != data_.hosts_.end(); host_iter++) { componentInstallation = getComponentInstallation((*host_iter).host); // // for each processcollocation // std::vector < ProcessData > ::const_iterator process_iter; for(process_iter = (*host_iter).processes.begin(); process_iter != (*host_iter).processes.end(); process_iter++) { // // for each homeplacement // std::vector < HomeInstanceData > ::const_iterator iter; for(iter = (*process_iter).homes.begin(); iter != (*process_iter).homes.end(); iter++) { // // remove component // try { DEBUG_OUT2( "AssemblyImpl: uninstall component ", (*iter).impl_id ); DEBUG_OUT2( "..... host is ", (*host_iter).host ); componentInstallation->remove( (*iter).impl_id.c_str() ); } catch(Components::Deployment::UnknownImplId&) { NORMAL_ERR3( "AssemblyImpl: component ", (*iter).impl_id, " not installed" ); NORMAL_ERR2( "..... host is ", (*host_iter).host ); } catch(Components::RemoveFailure&) { NORMAL_ERR3( "AssemblyImpl: component ", (*iter).impl_id, " not removed" ); NORMAL_ERR2( "..... host is ", (*host_iter).host ) } catch ( CORBA::SystemException& ) { NORMAL_ERR( "AssemblyImpl: CORBA system exception during uninstall()" ); throw Components::CreateFailure(); } } } } }
Components::Deployment::ComponentServer_ptr AssemblyImpl::createComponentServer (std::string dest) throw( Components::CreateFailure ) { DEBUG_OUT2("..... create new component server on ", dest); // // get server activator for destination // Components::Deployment::ServerActivator_var serverActivator; Components::Deployment::ComponentServer_var component_server; CORBA::Object_var obj = resolveName(SERVER_ACTIVATOR_CONTEXT + dest); if ( CORBA::is_nil(obj)) { DEBUG_OUT2(".......... no ServerActivator found for ", dest); throw Components::CreateFailure(); } serverActivator = Components::Deployment::ServerActivator::_narrow(obj.in()); if ( CORBA::is_nil(serverActivator.in())) { DEBUG_OUT(".......... ServerActivator is NIL "); throw Components::CreateFailure(); } // // create new Component Server // try { Components::ConfigValues_var config = new Components::ConfigValues(); component_server = serverActivator->create_component_server(config); } catch ( CORBA::SystemException& ) { std::cerr << ".......... CORBA system exception during create_component_server()" << std::endl; std::cerr << ".......... is ServerActivator running?" << std::endl; throw Components::CreateFailure(); } if (CORBA::is_nil(component_server)) { std::cerr << ".......... Component Server is NIL" << std::endl; throw Components::CreateFailure(); } return component_server._retn(); }
void StandardConfiguratorImpl::configure(::Components::CCMObject_ptr comp) throw( Components::WrongComponentType ) { for(CORBA::ULong i = 0; i < config_.length(); i++ ) { DEBUG_OUT2( "\nStandardConfigurator: configure ", config_[i]->name() ); // create a request according to the wire format of attribute operations std::string operation = "_set_"; operation.append( config_[i]->name() ); CORBA::Request_ptr request = comp->_request( operation.c_str() ); request->add_in_arg() = config_[i]->value(); // send the request try { request->invoke(); } catch( CORBA::SystemException& ex ) { std::cerr << "StandardConfigurator: Unexpected System Exception" << &ex << std::endl; } // check for exceptions CORBA::Exception* ex = request->env()->exception(); if ( ex != 0 ) { std::cerr << "StandardConfigurator: Exception during configuration : " << ex << std::endl; } } }
Components::CCMHome_ptr ContainerInterfaceImpl::install_home (const char* id, const char* entrypt, const Components::ConfigValues& config) throw (Components::Deployment::UnknownImplId, Components::Deployment::ImplEntryPointNotFound, Components::Deployment::InstallationFailure, Components::Deployment::InvalidConfiguration, CORBA::SystemException) { DEBUG_OUT2("ContainerInterfaceImpl: install_home() called for ", id); // // analyse the configuration values // Components::ConfigValue* value; const char* homefinder_name = 0; const char* service_name = 0; for (CORBA::ULong i = 0; i < config.length(); i++) { value = config[i].in(); if (! strcmp (config[i]->name(), "HOMEFINDERNAME")) { config[i]->value() >>= homefinder_name; break; } if (! strcmp (config[i]->name(), "CCMSERVICE")) { config[i]->value() >>= service_name; break; }
std::string CSDReader::license (DOMElement* element) throw(CSDReadException) { std::string text = ""; DOMNode* node = element->getFirstChild(); if(node) { text = Qedo::transcode(node->getNodeValue()); } std::string ref = Qedo::transcode(element->getAttribute(X("href"))); if(ref.length()) { if(text.length()) { text.append("\n"); } text.append("for license see : "); text.append(ref); } DEBUG_OUT2( "CSDReader: <license> ", text ); return text; }
Components::EventConsumerBase_ptr PublisherPort::remove_consumer (Components::Cookie* cookie) throw (Components::InvalidConnection) { SubscribedConsumerVector::iterator con_iter; for (con_iter = consumers_.begin(); con_iter != consumers_.end(); con_iter++) { if ((*con_iter).same_consumer (cookie)) { Components::EventConsumerBase_var ret; ret = (*con_iter).consumer(); consumers_.erase ( con_iter ); DEBUG_OUT2 ( "PublisherPort: Publisher unsubscribed for port ", port_name_ ); return ret; } } throw Components::InvalidConnection(); }
DCI::DCIDescriptors* RepDCIManagerSessionImpl::get_node_properties(const char* node_name) throw(CORBA::SystemException, ::Components::InvalidName) { // BEGIN USER INSERT SECTION RepDCIManagerSessionImpl::get_node_properties /* * The 'get_node_properties' operation returns a * sequence of DCI descriptors containing the node properties * and potentially additional property files the node * properties descriptor refers to in an XML format. * * @return sequence of DCI properties in an XML format. */ DEBUG_OUT2( "RepDCIManagerSessionImpl::get_node_properties(): start... node=", node_name); //get NodeManager DCI::NodeManager_ptr node_manager_ = this->get_node_manager(node_name); CORBA::Object_var obj_; obj_ = node_manager_->provide_node_information (); ::DCI::NodeInformation_var node_information_ = ::DCI::NodeInformation::_narrow ( obj_); if (CORBA::is_nil(node_information_)) { NORMAL_ERR("RepDCIManagerSessionImpl::get_node_properties(): node_information_ nil!"); throw CORBA::SystemException(); } DEBUG_OUT( "RepDCIManagerSessionImpl::get_node_properties(): ...end"); return node_information_->get_node_properties(); // END USER INSERT SECTION RepDCIManagerSessionImpl::get_node_properties }
char* RepDCIManagerSessionImpl::install_with_descriptor(const char* descriptor) throw(CORBA::SystemException, ::Components::Deployment::InstallationFailure, ::DCI::AlreadyInstalled) { // BEGIN USER INSERT SECTION RepDCIManagerSessionImpl::install_with_descriptor /* * Transmit only descriptor to DCIManager, * implementation is to be downloaded by DCIManager (pull). * return assemblyUUID */ DEBUG_OUT( "RepDCIManagerSessionImpl::install_with_descriptor(): start..."); //feed repository DCI::RepFeeder_ptr repfeeder = context_->get_connection_rep_feeder(); if ( CORBA::is_nil ( repfeeder ) ) { NORMAL_ERR("RepDCIManagerSessionImpl::install_with_descriptor(): repfeeder connection nil!"); throw CORBA::SystemException(); } CORBA::Object_var obj = repfeeder->feed_assembly_with_descriptor(descriptor); MDE::Deployment::Assembly_var ass = MDE::Deployment::Assembly::_narrow(obj); if ( CORBA::is_nil ( ass ) ) { NORMAL_ERR("RepDCIManagerSessionImpl::install_with_descriptor(): assembly reference nil!"); throw CORBA::SystemException(); } //install assembly string assUUID = this->install(ass); DEBUG_OUT2( "RepDCIManagerSessionImpl::install_with_descriptor(): ...end return=", assUUID); return strdup(assUUID.c_str()); // END USER INSERT SECTION RepDCIManagerSessionImpl::install_with_descriptor }
Components::Cookie* StreamCCMObjectExecutor::bind(const char* name, StreamComponents::SinkStreamPort_ptr the_sink) throw(Components::InvalidName, StreamComponents::AlreadyBound, StreamComponents::InvalidBinding, StreamComponents::ExceededBindingLimit, CORBA::SystemException) { DEBUG_OUT ("StreamCCMObjectExecutor: bind() called"); SourceVector::iterator src_iter; for (src_iter = sources_.begin(); src_iter != sources_.end(); src_iter++) { if ((*src_iter)->port_name() == name) { return (*src_iter)->add_binding (the_sink); } } DEBUG_OUT2 ( "StreamCCMObjectExecutor: No source registered with name ", name ); throw Components::InvalidName(); }
void CCMContext::end_stream (const char* port_name) throw (StreamComponents::NoStream) { DEBUG_OUT2 ("CCMContext: end_stream() called on source port ", port_name); stream_ccm_object_executor_->end_stream_source (port_name); }
void CCMContext::send_buffer (const char* port_name, StreamComponents::StreamingBuffer_ptr buffer) throw (StreamComponents::NoStream) { DEBUG_OUT2 ("CCMContext: send_buffer() called on source port ", port_name); stream_ccm_object_executor_->send_buffer (port_name, buffer); }
void TransportRegistry::register_transport (const char* transport_protocol, TransportEndpointFactory* transport_factory) { DEBUG_OUT2 ("TransportRegistry: New transport registered for transport protocol ", transport_protocol); TransportEntry new_transport (transport_protocol, transport_factory); transports_.push_back (new_transport); }
ValueFactoryCleaner::~ValueFactoryCleaner() { if (is_registered_) { int dummy = 0; CORBA::ORB_var orb = CORBA::ORB_init (dummy, 0); DEBUG_OUT2( "..... unregister factory for ", repid_ ); orb->unregister_value_factory( repid_.c_str() ); } DEBUG_OUT ("ValueFactoryCleaner: Destructor called"); factory_->_remove_ref(); }
static int fsam_call_bios(int value) { if (bios_code) { int command = BIOS_MAGIC_COMMAND; DEBUG_OUT2("bios routine gets parameter eax=%X and ebx=%X\n", command, value); value = fsam_bios_routine(command, value); DEBUG_OUT1("bios routine results %X\n", value); return value; } return ~0; }
std::string CSDReader::title (DOMElement* element) throw(CSDReadException) { std::string text = ""; DOMNode* node = element->getFirstChild(); if(node) { text = Qedo::transcode(node->getNodeValue()); } DEBUG_OUT2( "CSDReader: <title> ", text ); return text; }
void EmitterPort::set_consumer (Components::EventConsumerBase_ptr consumer) throw (Components::AlreadyConnected) { if (! CORBA::is_nil (consumer_)) { throw Components::AlreadyConnected(); } consumer_ = Components::EventConsumerBase::_duplicate (consumer); DEBUG_OUT2 ("EmitterPort: New emitter connected for port ", port_name_); }
void AssemblyFactoryImpl::initialize() { try { CORBA::Object_var root_poa_obj = orb_->resolve_initial_references ("RootPOA"); root_poa_ = PortableServer::POA::_narrow (root_poa_obj); } catch (CORBA::ORB::InvalidName&) { NORMAL_ERR( "AssemblyFactoryImpl: no root POA available" ); throw CannotInitialize(); } catch (CORBA::SystemException&) { NORMAL_ERR( "AssemblyFactoryImpl: cannot narrow root POA" ); throw CannotInitialize(); } root_poa_manager_ = root_poa_->the_POAManager(); root_poa_manager_->activate(); // get NameService if (! initNameService(orb_)) { throw CannotInitialize(); } // bind AssemblyFactory CORBA::Object_var assemblyFactory_ref = this->_this(); std::string name = "Qedo/AssemblyFactory/"; char hostname[256]; gethostname(hostname, 256); name.append(hostname); if ( ! registerName(name, assemblyFactory_ref, true)) { throw CannotInitialize(); } DEBUG_OUT2( "AssemblyFactoryImpl: bound under ", name );; // // directory to put the packages // if (makeDir(packageDirectory_)) { NORMAL_ERR3( "AssemblyFactoryImpl: directory ", packageDirectory_, " can not be created"); throw CannotInitialize(); } }
std::string CADReader::description (DOMElement* element) throw(CADReadException) { std::string text = ""; DOMNode* node = element->getFirstChild(); if(node) { text = XMLString::transcode(node->getNodeValue()); } DEBUG_OUT2( "CADReader: <description> ", text ); return text; }
char* RepDCIManagerSessionImpl::update_with_descriptor(const char* old_assemblyUUID, const char* descriptor) throw(CORBA::SystemException, ::DCI::UninstallationFailure, ::DCI::AlreadyInstalled, ::Components::Deployment::InstallationFailure, ::DCI::UnknownAssembly) { // BEGIN USER INSERT SECTION RepDCIManagerSessionImpl::update_with_descriptor /* * Update an already installed assembly with a new descriptor. */ DEBUG_OUT2( "RepDCIManagerSessionImpl::update_with_descriptor(): start... old_uuid=", old_assemblyUUID); this->uninstall(old_assemblyUUID); return this->install_with_descriptor(descriptor); DEBUG_OUT( "RepDCIManagerSessionImpl::update_with_descriptor(): ...end"); // END USER INSERT SECTION RepDCIManagerSessionImpl::update_with_descriptor }
char* RepDCIManagerSessionImpl::lookup_assembly(const char* assemblyUUID) throw(CORBA::SystemException, ::DCI::UnknownAssembly) { // BEGIN USER INSERT SECTION RepDCIManagerSessionImpl::lookup_assembly /* * Obtain descriptor of an installed assembly. */ DEBUG_OUT2( "RepDCIManagerSessionImpl::lookup_assembly(): start... uuid=", assemblyUUID); //lookup assembly MDE::Deployment::Assembly_var ass; try { ass = this->get_assembly(assemblyUUID); } catch(...){ throw ::DCI::UnknownAssembly(); } string ret = ass->descriptor(); DEBUG_OUT2("RepDCIManagerSessionImpl::lookup_assembly(): ...end return=", ret); return strdup(ret.c_str()); // END USER INSERT SECTION RepDCIManagerSessionImpl::lookup_assembly }
void StreamCCMObjectExecutor::add_source (const char* name, const char* type_id, bool is_multiplex, const CORBA::RepositoryIdSeq& streamtypes, bool configured_for_async_call) { SourcePort* new_source_port = new SourcePort(name, type_id, is_multiplex, streamtypes, configured_for_async_call); SourcePort_smartptr source_smartptr (new_source_port); new_source_port->_remove_ref(); sources_.push_back (source_smartptr); DEBUG_OUT2 ("StreamCCMObjectExecutor: New source registered: ", name); }
void StreamCCMObjectExecutor::add_sink (const char* name, const char* type_id, const CORBA::RepositoryIdSeq& streamtypes, StreamComponents::SinkStreamPort_ptr the_sink, Qedo::StreamDataDispatcher* dispatcher) { SinkPort* new_sink_port = new SinkPort (name, type_id, streamtypes, the_sink, dispatcher); SinkPort_smartptr sink_smartptr (new_sink_port); new_sink_port->_remove_ref(); sinks_.push_back (sink_smartptr); DEBUG_OUT2 ("StreamCCMObjectExecutor: New sink registered: ", name); }
Components::Cookie* PublisherPort::add_consumer (Components::EventConsumerBase_ptr consumer) { // Create cookie Cookie_impl* new_cookie = new Cookie_impl(); // Create new consumer entry SubscribedConsumer new_entry (consumer, new_cookie); consumers_.push_back (new_entry); DEBUG_OUT2 ("PublisherPort: New publisher subscribed for port ", port_name_); return new_cookie; }
Components::CCMHome_ptr AssemblyImpl::getHomeInstance (std::string name) throw( Components::CreateFailure ) { Components::CCMHome_var obj; std::map < std::string, Components::CCMHome_var > ::iterator iter; iter = homeMap_.find(name); if (iter != homeMap_.end()) { obj = (*iter).second; return obj._retn(); } DEBUG_OUT2(".......... no home reference for ", name); throw Components::CreateFailure(); }