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)));