final Integer port = (overridePort != null ? overridePort : _raProperties.getPort()) ;
final String overridePath = overrideProperties.getPath() ;
final String path = (overridePath != null ? overridePath : _raProperties.getPath()) ;
final AMQConnectionFactory cf ;
if (url != null)
{
cf = new AMQConnectionFactory(url) ;
if (clientID != null)
{
cf.getConnectionURL().setClientName(clientID) ;
}
}
else
{
// create a URL to force the connection details
if ((host == null) || (port == null) || (path == null))
{
throw new QpidRAException("Configuration requires host/port/path if connectionURL is not specified") ;
}
final String username = (defaultUsername != null ? defaultUsername : "") ;
final String password = (defaultPassword != null ? defaultPassword : "") ;
final String client = (clientID != null ? clientID : "") ;
final String newurl = AMQConnectionURL.AMQ_PROTOCOL + "://" + username +":" + password + "@" + client + "/" + path + '?' + AMQConnectionURL.OPTIONS_BROKERLIST + "='tcp://" + host + ':' + port + '\'' ;
if (_log.isDebugEnabled())
{
_log.debug("Initialising connectionURL to " + newurl) ;
}
cf = new AMQConnectionFactory(newurl) ;
}
return cf ;
}