//first create template
JMXServiceURL url =
JmxServiceUrlFactory.forJconsoleOverRmiWithJndiInAppserver(
HOST_HOLDER_VALUE, PORT_HOLDER_VALUE);
String strUrl = url.toString();
//now - modify it
JmxConnector bean = (JmxConnector)this.getBaseConfigBean();
String host = bean.getAddress();
if(host!=null && host.trim().equals("0.0.0.0"))
{
//host = InetAddress.getLocalHost().getHostName();
host = null; //left <host-name> placeholder in url
}
if(host!=null)
strUrl = strUrl.replaceAll(HOST_HOLDER_VALUE, host);
try {
int port = Integer.parseInt(bean.getPort());
strUrl = strUrl.replaceAll(String.valueOf(PORT_HOLDER_VALUE),
String.valueOf(port));
} catch (Exception e)
{
strUrl = strUrl.replaceAll(String.valueOf(PORT_HOLDER_VALUE),
"<port>");
}
return strUrl;