ACE_CString_Vector MACIContainerServices::findComponents(const char *nameWildcard, const char *typeWildcard) { ACE_CString_Vector names; if(nameWildcard == NULL) { nameWildcard = "*"; } if(typeWildcard == NULL) { typeWildcard = "*"; } maci::HandleSeq seq; maci::ComponentInfoSeq_var devs = m_manager->get_component_info(m_componentHandle,seq,nameWildcard,typeWildcard,false); CORBA::ULong len = devs->length (); for (CORBA::ULong i=0; i < len; i++) { names.push_back(devs[i].name.in()); } return names; }
void MACIContainerServices::releaseAllComponents() { ACE_CString_Vector componentsToRelease; { ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_usedComponents.mutex()); // get reverse deactivation order of components for (COMPONENT_HASH_MAP::CONST_ITERATOR iter(m_usedComponents); !iter.done(); iter.advance()) componentsToRelease.push_back(iter->key()); } unsigned int len = componentsToRelease.size(); for (unsigned int i = 0; i < len; i++) this->releaseComponent(componentsToRelease[i].c_str()); }
void ContainerServices::fireComponentsUnavailable(ACE_CString_Vector& compNames){ if (!withCompListener || compListener == NULL) { return; } // find out which components are interesting for the client /* //TODO:find a way how to know the used components ACE_CString_Vector & interesting; if (compListener->includeForeignComponents()) { interesting = compNames; } else { int i; for (i=0; i< (int)compNames.size(); i++) { ACE_CString cn = compNames[i]; if (m_usedComponentsMap.containsKey(cn) || m_usedNonStickyComponentsMap.containsKey(cn) ) { interesting.add(cn); } } } */ if (compNames.size() > 0) { try { compListener->componentsUnavailable(compNames); } catch (...) { ACS_SHORT_LOG((LM_INFO, "componentsUnavailable implementation of client %s failed", m_componentName.c_str())); } } }
void MACIContainerServices::fireComponentsUnavailable(ACE_CString_Vector& compNames){ if (!withCompListener || compListener == NULL) { return; } if (compListener->includeForeignComponents()) { ContainerServices::fireComponentsUnavailable(compNames); } else if (m_usedComponents.current_size() > 0) { ACE_CString_Vector interesting; for (int i=0; i < (int)compNames.size(); i++) { ACE_CString cn = compNames[i]; if (m_usedComponents.find(cn) != -1) { interesting.push_back(cn); } } if (interesting.size() > 0) ContainerServices::fireComponentsUnavailable(interesting); } }
void ContainerServices::fireComponentsAvailable (ACE_CString_Vector& compNames) { if (!withCompListener || compListener == NULL) { return; } if (compNames.size() > 0) { try { compListener->componentsAvailable(compNames); } catch (...) { ACS_SHORT_LOG((LM_INFO, "componentsAvailable implementation of client %s failed", m_componentName.c_str())); } } }