_options = props;
}
public ConnectionSettings buildConnectionSettings()
{
ConnectionSettings conSettings = new ConnectionSettings();
conSettings.setHost(getHost());
conSettings.setPort(getPort());
// ------------ sasl options ---------------
if (getProperty(BrokerDetails.OPTIONS_SASL_MECHS) != null)
{
conSettings.setSaslMechs(
getProperty(BrokerDetails.OPTIONS_SASL_MECHS));
}
// Sun SASL Kerberos client uses the
// protocol + servername as the service key.
if (getProperty(BrokerDetails.OPTIONS_SASL_PROTOCOL_NAME) != null)
{
conSettings.setSaslProtocol(
getProperty(BrokerDetails.OPTIONS_SASL_PROTOCOL_NAME));
}
if (getProperty(BrokerDetails.OPTIONS_SASL_SERVER_NAME) != null)
{
conSettings.setSaslServerName(
getProperty(BrokerDetails.OPTIONS_SASL_SERVER_NAME));
}
conSettings.setUseSASLEncryption(
getBooleanProperty(BrokerDetails.OPTIONS_SASL_ENCRYPTION));
// ------------- ssl options ---------------------
conSettings.setUseSSL(getBooleanProperty(BrokerDetails.OPTIONS_SSL));
if (getProperty(BrokerDetails.OPTIONS_TRUST_STORE) != null)
{
conSettings.setTrustStorePath(
getProperty(BrokerDetails.OPTIONS_TRUST_STORE));
}
if (getProperty(BrokerDetails.OPTIONS_TRUST_STORE_PASSWORD) != null)
{
conSettings.setTrustStorePassword(
getProperty(BrokerDetails.OPTIONS_TRUST_STORE_PASSWORD));
}
if (getProperty(BrokerDetails.OPTIONS_KEY_STORE) != null)
{
conSettings.setKeyStorePath(
getProperty(BrokerDetails.OPTIONS_KEY_STORE));
}
if (getProperty(BrokerDetails.OPTIONS_KEY_STORE_PASSWORD) != null)
{
conSettings.setKeyStorePassword(
getProperty(BrokerDetails.OPTIONS_KEY_STORE_PASSWORD));
}
if (getProperty(BrokerDetails.OPTIONS_SSL_CERT_ALIAS) != null)
{
conSettings.setCertAlias(
getProperty(BrokerDetails.OPTIONS_SSL_CERT_ALIAS));
}
// ----------------------------
conSettings.setVerifyHostname(getBooleanProperty(BrokerDetails.OPTIONS_SSL_VERIFY_HOSTNAME));
if (getProperty(BrokerDetails.OPTIONS_TCP_NO_DELAY) != null)
{
conSettings.setTcpNodelay(
getBooleanProperty(BrokerDetails.OPTIONS_TCP_NO_DELAY,true));
}
conSettings.setConnectTimeout(lookupConnectTimeout());
if (getProperty(BrokerDetails.OPTIONS_HEARTBEAT) != null)
{
conSettings.setHeartbeatInterval(getIntegerProperty(BrokerDetails.OPTIONS_HEARTBEAT));
}
else if (getProperty(BrokerDetails.OPTIONS_IDLE_TIMEOUT) != null)
{
conSettings.setHeartbeatInterval(getIntegerProperty(BrokerDetails.OPTIONS_IDLE_TIMEOUT) / 1000);
}
return conSettings;
}