if (!port.equals(CHANGE_ME)) {
namingPort = port;
}
}
final JBossProductType productType = installInfo.getProductType();
String description = productType.DESCRIPTION + " " + installInfo.getMajorVersion();
boolean isRhqServer = isRhqServer(absoluteConfigPath);
if (isRhqServer) {
description += " hosting the RHQ Server";
// RHQ-633 : We know this is an RHQ Server. Let's auto-configure for tracking its log file, which is not in
// the standard JBoss AS location.
// JOPR-53 : Log tracking will be disabled - user will have to explicitly enable it now.
File rhqLogFile = JBossASServerComponent.resolvePathRelativeToHomeDir(pluginConfiguration,
"../logs/rhq-server-log4j.log");
if (rhqLogFile.exists() && !rhqLogFile.isDirectory()) {
try {
PropertyMap serverLogEventSource = new PropertyMap("logEventSource");
serverLogEventSource.put(new PropertySimple(
LogFileEventResourceComponentHelper.LogEventSourcePropertyNames.LOG_FILE_PATH, rhqLogFile
.getCanonicalPath()));
serverLogEventSource.put(new PropertySimple(
LogFileEventResourceComponentHelper.LogEventSourcePropertyNames.ENABLED, Boolean.FALSE));
serverLogEventSource.put(new PropertySimple(
LogFileEventResourceComponentHelper.LogEventSourcePropertyNames.MINIMUM_SEVERITY,
EventSeverity.INFO.name().toLowerCase()));
PropertyList logEventSources = pluginConfiguration
.getList(LogFileEventResourceComponentHelper.LOG_EVENT_SOURCES_CONFIG_PROP);
logEventSources.add(serverLogEventSource);
} catch (IOException e) {
log.warn("Unable to setup RHQ Server log file monitoring.", e);
}
}
}
String name = formatServerName(bindingAddress, namingPort, discoveryContext.getSystemInformation().getHostname(),
absoluteConfigPath.getName(), productType, isRhqServer);
String version = productType.name() + " " + installInfo.getVersion();
return new DiscoveredResourceDetails(discoveryContext.getResourceType(), key, name, version, description,
pluginConfiguration, processInfo);
}