{
CurrentActor.get().message(ManagementConsoleMessages.READY(true));
return;
}
IApplicationRegistry appRegistry = ApplicationRegistry.getInstance();
//Socket factories for the RMIConnectorServer, either default or SLL depending on configuration
RMIClientSocketFactory csf;
RMIServerSocketFactory ssf;
//check ssl enabled option in config, default to true if option is not set
boolean sslEnabled = appRegistry.getConfiguration().getManagementSSLEnabled();
if (sslEnabled)
{
//set the SSL related system properties used by the SSL RMI socket factories to the values
//given in the configuration file, unless command line settings have already been specified
String keyStorePath;
if(System.getProperty("javax.net.ssl.keyStore") != null)
{
keyStorePath = System.getProperty("javax.net.ssl.keyStore");
}
else
{
keyStorePath = appRegistry.getConfiguration().getManagementKeyStorePath();
}
//check the keystore path value is valid
if (keyStorePath == null)
{
throw new ConfigurationException("JMX management SSL keystore path not defined, " +
"unable to start SSL protected JMX ConnectorServer");
}
else
{
//ensure the system property is set
System.setProperty("javax.net.ssl.keyStore", keyStorePath);
//check the file is usable
File ksf = new File(keyStorePath);
if (!ksf.exists())
{
throw new FileNotFoundException("Cannot find JMX management SSL keystore file: " + ksf);
}
if (!ksf.canRead())
{
throw new FileNotFoundException("Cannot read JMX management SSL keystore file: "
+ ksf + ". Check permissions.");
}
CurrentActor.get().message(ManagementConsoleMessages.SSL_KEYSTORE(ksf.getAbsolutePath()));
}
//check the key store password is set
if (System.getProperty("javax.net.ssl.keyStorePassword") == null)
{
if (appRegistry.getConfiguration().getManagementKeyStorePassword() == null)
{
throw new ConfigurationException("JMX management SSL keystore password not defined, " +
"unable to start requested SSL protected JMX server");
}
else
{
System.setProperty("javax.net.ssl.keyStorePassword",
appRegistry.getConfiguration().getManagementKeyStorePassword());
}
}
//create the SSL RMI socket factories
csf = new SslRMIClientSocketFactory();