+ "the \"main\" Apache server in httpd.conf.");
} else {
configured = true;
}
} catch (MalformedURLException e) {
throw new InvalidPluginConfigurationException("Value of '" + PLUGIN_CONFIG_PROP_URL
+ "' connection property ('" + url + "') is not a valid URL.");
}
}
bmxUrl = pluginConfig.getSimpleValue(PLUGIN_CONFIG_PROP_BMX_URL, null);
if (bmxUrl != null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Checking BMX url " + bmxUrl);
}
try {
URL uurl = new URL(bmxUrl);
if (uurl.getPort() == 0) {
LOG.error("The 'BMX Handler' connection property is invalid - 0 is not a valid port; please change the value to the "
+ "port the Apache server is listening on.");
} else {
if (this.url == null) {
this.url = uurl;
configured = true;
}
}
} catch (MalformedURLException e) {
throw new InvalidPluginConfigurationException("Value of '" + PLUGIN_CONFIG_PROP_BMX_URL
+ "' connection property ('" + bmxUrl + "') is not a valid URL.");
}
}
if (bmxUrl != null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Testing BMX connection on " + bmxUrl);
}
try {
/* Check the BMX URL and use it if available */
URL uurl = new URL(bmxUrl);
HttpURLConnection conn = (HttpURLConnection) uurl.openConnection();
conn.connect();
if (conn.getResponseCode() == 200) {
useBMX = true;
LOG.info("BMX will be used to check availability");
}
conn.disconnect();
} catch (Exception ex) {
if (LOG.isDebugEnabled()) {
LOG.debug("BMX connection fails on " + bmxUrl + " with " + ex);
}
}
}
if (!configured) {
throw new InvalidPluginConfigurationException(
"Neither SNMP, BMX nor an URL for checking availability has been configured");
}
File executablePath = getExecutablePath();
try {
this.binaryInfo = ApacheBinaryInfo.getInfo(executablePath.getPath(),
this.resourceContext.getSystemInformation());
} catch (Exception e) {
throw new InvalidPluginConfigurationException("'" + executablePath
+ "' is not a valid Apache executable (" + e + ").");
}
this.operationsDelegate = new ApacheServerOperationsDelegate(this, pluginConfig,
this.resourceContext.getSystemInformation());