Author: pferraro
Date: 2008-10-31 16:14:18 -0400 (Fri, 31 Oct 2008)
New Revision: 2037
Modified:
trunk/mod_cluster/src/main/java/org/jboss/modcluster/Utils.java
Log:
Add getAliases(Host)
Modified: trunk/mod_cluster/src/main/java/org/jboss/modcluster/Utils.java
===================================================================
--- trunk/mod_cluster/src/main/java/org/jboss/modcluster/Utils.java 2008-10-31 04:18:51
UTC (rev 2036)
+++ trunk/mod_cluster/src/main/java/org/jboss/modcluster/Utils.java 2008-10-31 20:14:18
UTC (rev 2037)
@@ -95,13 +95,10 @@
public static String getAddress(Connector connector)
{
Object address = IntrospectionUtils.getProperty(connector.getProtocolHandler(),
"address");
- InetAddress inetAddress = null;
- if (address instanceof String)
- return (String) address;
- else
- inetAddress = (InetAddress) address;
-
- return (inetAddress != null) ? inetAddress.getHostAddress() :
"127.0.0.1";
+
+ if (address == null) return "127.0.0.1";
+
+ return (address instanceof InetAddress) ? ((InetAddress) address).getHostAddress()
: (String) address;
}
/**
@@ -114,16 +111,26 @@
{
return ((Engine) context.getParent().getParent()).getJvmRoute();
}
-
+
/**
- * Return the host and its alias list with which the context is associated.
+ * Returns the aliases of the host of the specified context, including its host name
*
* @param context
- * @return
+ * @return a set of aliases, including the host name
*/
public static Set<String> getAliases(Context context)
{
- Host host = (Host) context.getParent();
+ return getAliases((Host) context.getParent());
+ }
+
+ /**
+ * Returns the aliases of the specified host, including its name
+ *
+ * @param host
+ * @return a set of aliases, including the host name
+ */
+ public static Set<String> getAliases(Host host)
+ {
String name = host.getName();
String[] aliases = host.findAliases();