Beispiel #1
0
//------------------------------------------------------
    CDBProperties::EventHandlerTimeoutMap
    CDBProperties::getEventHandlerTimeoutMap(const std::string& channelName)
    {
	EventHandlerTimeoutMap retVal;

	//sanity check
	if (cdbChannelConfigExists(channelName)==false)
	    {
	    return retVal;
	    }

	//CDB
	//complete name of the channel within the CDB
	std::string cdbChannelName = "MACI/Channels/" + channelName;
	CDB::DAL_var cdbRef = getCDB();
	CDB::DAO_var tempDAO = cdbRef->get_DAO_Servant(cdbChannelName.c_str());
	CDB::stringSeq_var keys;
	//names of all the events
	try {
	keys = tempDAO->get_string_seq("Events");
	}
	catch(...){
	return retVal;
	}
	    
	//another sanity check
	if (keys.ptr()==0)
	    {
	    return retVal;
	    }
	
	//populate the map
	for (CORBA::ULong i=0; i<keys->length(); i++) 
	    {
	    //get the key's value
	    std::string timeoutLocation = "Events/";
	    timeoutLocation =  timeoutLocation + (const char*)keys[i] + "/MaxProcessTime";
	    double value = tempDAO->get_double(timeoutLocation.c_str());
	    
	    //set the map's contents
	    retVal[(const char*)keys[i]] = value;
	    }
	return retVal;
    }
Beispiel #2
0
//-----------------------------------------------------------------------------
char*
BaseHelper::getNotificationFactoryNameForChannel(CDB::DAL_ptr cdbRef, const char* channelName, const char* domainName)
{
//sanity check
if(CORBA::is_nil(cdbRef))
    {
    ACS_STATIC_SHORT_LOG((LM_DEBUG,
			  "BaseHelper::getNotificationFactoryNameForChannel",
			  "CDB ref null."));
    return 0;
    }

std::string cdbChannelsName = "MACI/Channels";
CDB::DAO_var tempDAO;
//try reading the entry from the CDB
try
    {
		tempDAO = cdbRef->get_DAO_Servant(cdbChannelsName.c_str());
		//sanity check, should not happen
	    if (tempDAO.in()==0)
	      return 0;
//DAL throws exceptions if the entry being searched for does not
//exist
    }
catch(...)
    {
    ACS_STATIC_SHORT_LOG((LM_DEBUG,
			  "BaseHelper::getNotificationFactoryNameForChannel",
			  "No CDB entry found for '%s' channel. OK.",
			  cdbChannelsName.c_str()));
    return 0;
    }

// if channel mapping exists take it, wildchars are also supported
try
    {
    CDB::stringSeq_var channelNameList = tempDAO->get_string_seq("NotificationServiceMapping/Channels_");
    for (CORBA::ULong n = 0; n < channelNameList->length(); n++)
        if (Wildcard::wildcardfit(channelNameList[n], channelName))
            return CORBA::string_dup(tempDAO->get_string((std::string("NotificationServiceMapping/Channels_/") + channelNameList[n].in() + "/NotificationService").c_str())); 
    }
catch(...)
    {
    ACS_STATIC_SHORT_LOG((LM_DEBUG,
			  "BaseHelper::getNotificationFactoryNameForChannel",
			  "No Channel to NotificationService mapping found for channel'%s' channel.",
			  channelName));
    }
    
// if domain mapping, if given
if (domainName)
	try
    {
    return CORBA::string_dup(tempDAO->get_string((std::string("NotificationServiceMapping/Domains/") + domainName + "/NotificationService").c_str())); 
    }
catch(...)
    {
    ACS_STATIC_SHORT_LOG((LM_DEBUG,
			  "BaseHelper::getNotificationFactoryNameForChannel",
			  "No Domain to NotificationService mapping found for domain/channel'%s/%s' channel. OK.",
			  domainName, channelName));
    }
    
// if default
	try
    {
    return CORBA::string_dup(tempDAO->get_string("NotificationServiceMapping/DefaultNotificationService")); 
    }
catch(...)
    {
    ACS_STATIC_SHORT_LOG((LM_DEBUG,
			  "BaseHelper::getNotificationFactoryNameForChannel",
			  "No NotificationServiceMapping/DefaultNotificationService attribute found. OK.",
			  domainName, channelName));
    }

	// not found
    return 0;
}