Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Commit

Permalink
[BZ 1080552] Add the value of the name attribute of the host element …
Browse files Browse the repository at this point in the history
…to the resource name. This is applicable only to host controllers for now.
  • Loading branch information
Stefan Negrea committed May 6, 2014
1 parent d039b7e commit f72a2c4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ protected DiscoveredResourceDetails buildResourceDetails(ResourceDiscoveryContex

String key = createKeyForLocalResource(serverPluginConfig);
HostPort hostPort = hostConfig.getDomainControllerHostPort(commandLine);
String name = buildDefaultResourceName(hostPort, managementHostPort, productType);
String name = buildDefaultResourceName(hostPort, managementHostPort, productType, hostConfig.getHostName());
String description = buildDefaultResourceDescription(hostPort, productType);
String version = getVersion(homeDir, productType);

Expand Down Expand Up @@ -428,7 +428,8 @@ protected File getLogFile(File logDir) {

protected abstract String getLogFileName();

protected abstract String buildDefaultResourceName(HostPort hostPort, HostPort managementHostPort, JBossProductType productType);
protected abstract String buildDefaultResourceName(HostPort hostPort, HostPort managementHostPort,
JBossProductType productType, String serverName);

protected abstract String buildDefaultResourceDescription(HostPort hostPort, JBossProductType productType);

Expand Down Expand Up @@ -458,7 +459,7 @@ public DiscoveredResourceDetails discoverResource(Configuration pluginConfig,
managementHostPort.host = hostname;
managementHostPort.port = port;
String key = createKeyForRemoteResource(hostname + ":" + port);
String name = buildDefaultResourceName(hostPort, managementHostPort, productType);
String name = buildDefaultResourceName(hostPort, managementHostPort, productType, null);
String version = productInfo.getProductVersion();
String description = buildDefaultResourceDescription(hostPort, productType);

Expand All @@ -484,7 +485,7 @@ public ResourceUpgradeReport upgrade(ResourceUpgradeContext inventoriedResource)
boolean hasLocalResourcePrefix = currentResourceKey.startsWith(LOCAL_RESOURCE_KEY_PREFIX);
boolean hasRemoteResourcePrefix = currentResourceKey.startsWith(REMOTE_RESOURCE_KEY_PREFIX);
if (!hasLocalResourcePrefix && !hasRemoteResourcePrefix) {
// Resource key in wrong format
// Resource key in wrong format
upgraded = true;
if (new File(currentResourceKey).isDirectory()) {
// Old key format for a local resource (key is base dir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package org.rhq.modules.plugins.jbossas7;

import org.rhq.core.pluginapi.util.CommandLineOption;
import org.rhq.core.system.ProcessInfo;
import org.rhq.modules.plugins.jbossas7.helper.HostPort;

Expand Down Expand Up @@ -64,11 +63,18 @@ protected String getLogFileName() {
}

@Override
protected String buildDefaultResourceName(HostPort hostPort, HostPort managementHostPort, JBossProductType productType) {
protected String buildDefaultResourceName(HostPort hostPort, HostPort managementHostPort,
JBossProductType productType, String serverName) {
boolean isDomainController = hostPort.isLocal;
String instanceType = (isDomainController) ? "Domain Controller" : "Host Controller";

if (serverName != null && !serverName.trim().isEmpty()) {
return String.format("%s %s (%s %s:%d)", productType.SHORT_NAME, instanceType, serverName,
managementHostPort.host, managementHostPort.port);
}

return String.format("%s %s (%s:%d)", productType.SHORT_NAME, instanceType, managementHostPort.host,
managementHostPort.port);
managementHostPort.port);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ protected String getLogFileName() {

@Override
protected String buildDefaultResourceName(HostPort hostPort, HostPort managementHostPort,
JBossProductType productType) {
JBossProductType productType, String serverName) {
if (serverName != null && !serverName.trim().isEmpty()) {
return String.format("%s (%s %s:%d)", productType.SHORT_NAME, serverName, managementHostPort.host,
managementHostPort.port);
}

return String.format("%s (%s:%d)", productType.SHORT_NAME, managementHostPort.host, managementHostPort.port);
}

Expand Down

0 comments on commit f72a2c4

Please sign in to comment.