org.rhq.modules.plugins.jbossas7.helper
Class HostConfiguration

java.lang.Object
  extended by org.rhq.modules.plugins.jbossas7.helper.HostConfiguration

public class HostConfiguration
extends Object

A host configuration - loaded from either standalone.xml or host.xml.

Author:
Heiko Rupp

Field Summary
static int DEFAULT_MGMT_PORT
           
 
Constructor Summary
HostConfiguration(File hostXmlFile)
           
 
Method Summary
 String getHostName()
          Try to determine the host name - that is the name of a standalone server or a host in domain mode by looking at the standalone.xml/host.xml files
 HostPort getHostPort(AS7CommandLine commandLine)
          Try to obtain the domain controller's location from looking at host.xml
 HostPort getManagementHostPort(AS7CommandLine commandLine, AS7Mode mode)
          Try to obtain the management IP and port from the already parsed host.xml or standalone.xml
 String getManagementSecurityRealm()
           
 File getSecurityPropertyFile(File baseDir, AS7Mode mode, String realm)
           
 String obtainXmlPropertyViaXPath(String xpathExpression)
          Run the passed xpathExpression on the prepopulated hostXml document and return the target element or attribute as a String.
protected  String replaceDollarExpression(String value, AS7CommandLine commandLine, String lastResort)
          Check if the passed value has an expression in the form of ${var} or ${var:default}, try to resolve it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MGMT_PORT

public static final int DEFAULT_MGMT_PORT
See Also:
Constant Field Values
Constructor Detail

HostConfiguration

public HostConfiguration(File hostXmlFile)
                  throws Exception
Parameters:
hostXmlFile - absolute path to standalone.xml or host.xml file
Throws:
Exception
Method Detail

getManagementHostPort

public HostPort getManagementHostPort(AS7CommandLine commandLine,
                                      AS7Mode mode)
Try to obtain the management IP and port from the already parsed host.xml or standalone.xml

Parameters:
commandLine - Command line arguments of the process to
Returns:
an Object containing host and port

getHostName

public String getHostName()
Try to determine the host name - that is the name of a standalone server or a host in domain mode by looking at the standalone.xml/host.xml files

Returns:
server name

getHostPort

public HostPort getHostPort(AS7CommandLine commandLine)
Try to obtain the domain controller's location from looking at host.xml

Returns:
host and port of the domain controller

getManagementSecurityRealm

public String getManagementSecurityRealm()

getSecurityPropertyFile

public File getSecurityPropertyFile(File baseDir,
                                    AS7Mode mode,
                                    String realm)

obtainXmlPropertyViaXPath

public String obtainXmlPropertyViaXPath(String xpathExpression)
Run the passed xpathExpression on the prepopulated hostXml document and return the target element or attribute as a String.

Parameters:
xpathExpression - XPath Expression to evaluate
Returns:
String value of the Element or Attribute the XPath was pointing to. Null in case the xpathExpression could not be evaluated.
Throws:
IllegalArgumentException - if hostXml is null

replaceDollarExpression

protected String replaceDollarExpression(String value,
                                         AS7CommandLine commandLine,
                                         String lastResort)
Check if the passed value has an expression in the form of ${var} or ${var:default}, try to resolve it. Resolution is done by looking at the command line to see if there are -bmanagement or -Djboss.bind.address.management arguments present

Parameters:
value - a hostname or hostname expression
commandLine - The command line from the process
lastResort - fall back to this value if the value could not be found on the command line and the expression did not specify a default value
Returns:
resolved value


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.