BrokerOptions.DEFAULT_LOG_CONFIG_FILE, qpidHome, false);
configureLogging(logConfigFile, options.getLogWatchFrequency());
ConfigurationFileApplicationRegistry config = new ConfigurationFileApplicationRegistry(configFile, options.getBundleContext());
ServerConfiguration serverConfig = config.getConfiguration();
updateManagementPorts(serverConfig, options.getJmxPortRegistryServer(), options.getJmxPortConnectorServer());
ApplicationRegistry.initialise(config);
// We have already loaded the BrokerMessages class by this point so we
// need to refresh the locale setting incase we had a different value in
// the configuration.
BrokerMessages.reload();
// AR.initialise() sets and removes its own actor so we now need to set the actor
// for the remainder of the startup, and the default actor if the stack is empty
CurrentActor.set(new BrokerActor(config.getCompositeStartupMessageLogger()));
CurrentActor.setDefault(new BrokerActor(config.getRootMessageLogger()));
GenericActor.setDefaultMessageLogger(config.getRootMessageLogger());
try
{
configureLoggingManagementMBean(logConfigFile, options.getLogWatchFrequency());
ConfigurationManagementMBean configMBean = new ConfigurationManagementMBean();
configMBean.register();
ServerInformationMBean sysInfoMBean = new ServerInformationMBean(config);
sysInfoMBean.register();
Set<Integer> ports = new HashSet<Integer>(options.getPorts());
if(ports.isEmpty())
{
parsePortList(ports, serverConfig.getPorts());
}
Set<Integer> sslPorts = new HashSet<Integer>(options.getSSLPorts());
if(sslPorts.isEmpty())
{
parsePortList(sslPorts, serverConfig.getSSLPorts());
}
Set<Integer> exclude_0_10 = new HashSet<Integer>(options.getExcludedPorts(ProtocolExclusion.v0_10));
if(exclude_0_10.isEmpty())
{
parsePortList(exclude_0_10, serverConfig.getPortExclude010());
}
Set<Integer> exclude_0_9_1 = new HashSet<Integer>(options.getExcludedPorts(ProtocolExclusion.v0_9_1));
if(exclude_0_9_1.isEmpty())
{
parsePortList(exclude_0_9_1, serverConfig.getPortExclude091());
}
Set<Integer> exclude_0_9 = new HashSet<Integer>(options.getExcludedPorts(ProtocolExclusion.v0_9));
if(exclude_0_9.isEmpty())
{
parsePortList(exclude_0_9, serverConfig.getPortExclude09());
}
Set<Integer> exclude_0_8 = new HashSet<Integer>(options.getExcludedPorts(ProtocolExclusion.v0_8));
if(exclude_0_8.isEmpty())
{
parsePortList(exclude_0_8, serverConfig.getPortExclude08());
}
String bindAddr = options.getBind();
if (bindAddr == null)
{
bindAddr = serverConfig.getBind();
}
InetAddress bindAddress = null;
if (bindAddr.equals(WILDCARD_ADDRESS))
{
bindAddress = new InetSocketAddress(0).getAddress();
}
else
{
bindAddress = InetAddress.getByAddress(parseIP(bindAddr));
}
String hostName = bindAddress.getCanonicalHostName();
if (!serverConfig.getSSLOnly())
{
for(int port : ports)
{
final Set<AmqpProtocolVersion> supported =
getSupportedVersions(port, exclude_0_10, exclude_0_9_1, exclude_0_9, exclude_0_8);
final NetworkTransportConfiguration settings =
new ServerNetworkTransportConfiguration(serverConfig, port, bindAddress.getHostName(), Transport.TCP);
final IncomingNetworkTransport transport = Transport.getIncomingTransportInstance();
final MultiVersionProtocolEngineFactory protocolEngineFactory =
new MultiVersionProtocolEngineFactory(hostName, supported);
transport.accept(settings, protocolEngineFactory, null);
ApplicationRegistry.getInstance().addAcceptor(new InetSocketAddress(bindAddress, port),
new QpidAcceptor(transport,"TCP"));
CurrentActor.get().message(BrokerMessages.LISTENING("TCP", port));
}
}
if (serverConfig.getEnableSSL())
{
final String keystorePath = serverConfig.getConnectorKeyStorePath();
final String keystorePassword = serverConfig.getConnectorKeyStorePassword();
final String certType = serverConfig.getConnectorCertType();
final SSLContext sslContext = SSLContextFactory.buildServerContext(keystorePath, keystorePassword, certType);
for(int sslPort : sslPorts)
{
final Set<AmqpProtocolVersion> supported =