コード例 #1
0
// initialize remote log from the properties file. 
// ideally this is done in Log::initialize however due to 
// the dependency of remote log on connection which depends on log 
// (see base_init in am_main.cpp) this is done seperately.
am_status_t Log::initializeRemoteLog(const Properties& propertiesRef) 
    throw()
{
    am_status_t status = AM_SUCCESS;

    // Create logging servcie URL from naming service since no
    // sso token is available to read the naming service.

    try {
	const std::string namingservice("/namingservice");
	const std::string loggingservice("/loggingservice");
	const std::string namingURL(
	    propertiesRef.get(AM_COMMON_NAMING_URL_PROPERTY, ""));
	std::string logURL = namingURL;
	std::size_t pos = 0;

	pos = logURL.find (namingservice, pos);
	while (pos != std::string::npos) {
	    logURL.replace(pos, namingservice.size(), loggingservice);
	    pos = logURL.find (namingservice, pos + 1);
	}

	URL verifyURL(logURL);
	LogService *newLogSvc = 
	    new LogService(ServiceInfo(logURL),
			   propertiesRef,
			   propertiesRef.get(
			       AM_COMMON_CERT_DB_PASSWORD_PROPERTY,""),
			   propertiesRef.get(
			       AM_AUTH_CERT_ALIAS_PROPERTY, ""),
			   propertiesRef.getBool(
			       AM_COMMON_TRUST_SERVER_CERTS_PROPERTY, false),
			   1);
	Log::setRemoteInfo(newLogSvc);
    }
    catch (std::bad_alloc& exb) {
	status = AM_NO_MEMORY;
    }
    catch (std::exception& exs) {
	status = AM_INVALID_ARGUMENT;
    }
    catch (...) {
	status = AM_FAILURE;
    }
    return status;
}
コード例 #2
0
/**
 * Sets mAuthSvcInfo member variable
 * Throws: InternalException upon error
 */
void
AgentProfileService::setAuthSvcInfo(std::string authURL)
{

    try {
        URL verifyURL(authURL);
    } catch (InternalException &iex) {
        throw InternalException("AuthService::setAuthSvcInfo()",
                                "Malformed URL.",
                                AM_AUTH_FAILURE);
    }

    mAuthSvcInfo.setFromString(authURL);
    Log::log(logModule, Log::LOG_MAX_DEBUG,
             "Number of servers in service:%d, '%s'.",
             mAuthSvcInfo.getNumberOfServers(), authURL.c_str());

    return;
}