baseDir = null;
LOG.error("Failed to validate base dir for " + getResourceDescription() + ".", e);
}
if ((runtimeBaseDir != null) && (baseDir != null)) {
if (!runtimeBaseDir.equals(baseDir)) {
throw new InvalidPluginConfigurationException("The server listening on "
+ serverPluginConfig.getHostname() + ":" + serverPluginConfig.getPort() + " has base dir ["
+ runtimeBaseDir + "], but the base dir we expected was [" + baseDir
+ "]. Perhaps the management hostname or port has been changed for the server with base dir ["
+ baseDir + "].");
}
}
// Validate the config dir (e.g. /opt/jboss-as-7.1.1.Final/standalone/configuration).
File runtimeConfigDir;
File configDir = null;
try {
String runtimeConfigDirString = readAttribute(getEnvironmentAddress(), getConfigDirAttributeName());
// Canonicalize both paths before comparing them!
runtimeConfigDir = new File(runtimeConfigDirString).getCanonicalFile();
File configDirTmp = serverPluginConfig.getConfigDir();
if (configDirTmp != null) { // may be null for manually added servers
configDir = configDirTmp.getCanonicalFile();
}
} catch (Exception e) {
runtimeConfigDir = null;
configDir = null;
LOG.error("Failed to validate config dir for " + getResourceDescription() + ".", e);
}
if ((runtimeConfigDir != null) && (configDir != null)) {
if (!runtimeConfigDir.equals(configDir)) {
throw new InvalidPluginConfigurationException("The server listening on "
+ serverPluginConfig.getHostname() + ":" + serverPluginConfig.getPort() + " has config dir ["
+ runtimeConfigDir + "], but the config dir we expected was [" + configDir
+ "]. Perhaps the management hostname or port has been changed for the server with config dir ["
+ configDir + "].");
}
}
// Validate the mode (e.g. STANDALONE or DOMAIN).
String runtimeMode;
try {
runtimeMode = readAttribute("launch-type");
} catch (Exception e) {
runtimeMode = null;
LOG.error("Failed to validate mode for " + getResourceDescription() + ".", e);
}
if (runtimeMode != null) {
String mode = getMode().name();
if (!runtimeMode.equals(mode)) {
throw new InvalidPluginConfigurationException("The original mode discovered for this AS7 server was "
+ getMode() + ", but the server is now reporting its mode is [" + runtimeMode + "].");
}
}
// Validate the product type (e.g. AS or EAP).
String expectedRuntimeProductName = pluginConfiguration.getSimpleValue("expectedRuntimeProductName");
String runtimeProductName;
try {
runtimeProductName = readAttribute(getHostAddress(), "product-name");
} catch (Exception e) {
throw new InvalidPluginConfigurationException("Failed to validate product type for "
+ getResourceDescription(), e);
}
if (runtimeProductName == null || runtimeProductName.trim().isEmpty()) {
String releaseVersionNumber;
try {
releaseVersionNumber = readAttribute(getHostAddress(), "release-version");
} catch (Exception e) {
throw new InvalidPluginConfigurationException("Failed to validate product type for "
+ getResourceDescription(), e);
}
if (releaseVersionNumber.startsWith("8.")) {
runtimeProductName = WILDFLY8.PRODUCT_NAME;
} else {
runtimeProductName = AS.PRODUCT_NAME;
}
}
if (!runtimeProductName.equals(expectedRuntimeProductName)) {
throw new InvalidPluginConfigurationException("The original product type discovered for this server was "
+ expectedRuntimeProductName + ", but the server is now reporting its product type is ["
+ runtimeProductName + "]");
}
}