// This is a "hidden" plugin config prop, i.e. it is intentionally not defined in the plugin descriptor.
serverPluginConfig.setHostConfigFile(hostXmlFile);
// This method must be called before getHostConfiguration() can be called.
HostConfiguration hostConfig = loadHostConfiguration(hostXmlFile);
String domainHost = findHost(hostXmlFile);
// this property is DEPRECATED we don't need it during discovery
pluginConfig.setSimpleValue("domainHost", domainHost);
File logDir = getLogDir(process, commandLine, baseDir);
serverPluginConfig.setLogDir(logDir);
File logFile = getLogFile(logDir);
initLogEventSourcesConfigProp(logFile.getPath(), pluginConfig);
HostPort managementHostPort = hostConfig.getManagementHostPort(commandLine, getMode());
serverPluginConfig.setHostname(managementHostPort.host);
serverPluginConfig.setPort(managementHostPort.port);
serverPluginConfig.setSecure(managementHostPort.isSecure);
HostPort nativeHostPort = hostConfig.getNativeHostPort(commandLine, getMode());
serverPluginConfig.setNativeHost(nativeHostPort.host);
serverPluginConfig.setNativePort(nativeHostPort.port);
pluginConfig.setSimpleValue("realm", hostConfig.getManagementSecurityRealm());
String apiVersion = hostConfig.getDomainApiVersion();
JBossProductType productType = JBossProductType.determineJBossProductType(homeDir, apiVersion);
serverPluginConfig.setProductType(productType);
pluginConfig.setSimpleValue("expectedRuntimeProductName", productType.PRODUCT_NAME);
pluginConfig.setSimpleValue("hostXmlFileName", getHostXmlFileName(commandLine));
ProcessInfo agentProcess = discoveryContext.getSystemInformation().getThisProcess();
setStartScriptPluginConfigProps(process, commandLine, pluginConfig, agentProcess);
setUserAndPasswordPluginConfigProps(serverPluginConfig, hostConfig);
String key = createKeyForLocalResource(serverPluginConfig);
HostPort hostPort = hostConfig.getDomainControllerHostPort(commandLine);
String name = buildDefaultResourceName(hostPort, managementHostPort, productType, hostConfig.getHostName());
String description = buildDefaultResourceDescription(hostPort, productType);
String version = getVersion(homeDir, productType);
pluginConfig.setSimpleValue("supportsPatching", Boolean.toString(supportsPatching(productType, version)));