コード例 #1
0
int StarterHookMgr::getHookTimeout(HookType hook_type, int def_value)
{
	if (!m_hook_keyword) return 0;
	MyString _param;
	_param.sprintf("%s_HOOK_%s_TIMEOUT", m_hook_keyword, getHookTypeString(hook_type));
	return param_integer(_param.Value(), def_value);
}
コード例 #2
0
bool StarterHookMgr::getHookPath(HookType hook_type, char*& hpath)
{
    hpath = NULL;
	if (!m_hook_keyword) return true;
	MyString _param;
	_param.sprintf("%s_HOOK_%s", m_hook_keyword, getHookTypeString(hook_type));
	return validateHookPath(_param.Value(), hpath);
}
コード例 #3
0
ファイル: JobRouterHookMgr.cpp プロジェクト: emaste/htcondor
char*
JobRouterHookMgr::getHookPath(HookType hook_type, classad::ClassAd ad)
{
	std::string keyword;
	char** paths;
	char* hook_path;

	if (0 == m_hook_maps[hook_type])
	{
		dprintf(D_ALWAYS, "JobRouterHookMgr failure: Unable to get hook path for unknown hook type '%s'\n", getHookTypeString(hook_type));
		return NULL;
	}

	keyword = getHookKeyword(ad);
	if (0 == keyword.length())
	{
		return NULL;
	}

	MyString key(keyword.c_str());
	if (0 > m_hook_paths.lookup(key, paths))
	{
		// Initialize the hook paths for this keyword
		paths = new char*[NUM_HOOKS];
		for (int i = 0; i < NUM_HOOKS; i++)
		{
			paths[i] = NULL;
		}
		m_hook_paths.insert(key, paths);
	}

	hook_path = paths[m_hook_maps[hook_type]-1];
	if (NULL == hook_path)
	{
		MyString _param;
		_param.formatstr("%s_HOOK_%s", keyword.c_str(), getHookTypeString(hook_type));
        // Here the distinction between undefined hook and a hook path error 
        // is being collapsed
		validateHookPath(_param.Value(), hook_path);
		dprintf(D_FULLDEBUG, "Hook %s: %s\n", _param.Value(),
			hook_path ? hook_path : "UNDEFINED");
	}
	else if (UNDEFINED == hook_path)
	{
		hook_path = NULL;
	}
	return hook_path;
}