* Create, configure, and return an NamingServer
*/
public NamingServer createNamingServer(String address, int port, String scheme)
{
log.debug("Creating namingServer");
StandardNamingServer namingServer = new StandardNamingServer();
namingServer.setDebug(debug);
namingServer.setPort(port);
namingServer.setScheme(scheme);
if (address != null)
{
/*
* InetAddress.toString() returns a string of the form
* "<hostname>/<literal_IP>". Get the latter part, so that the
* address can be parsed (back) into an InetAddress using
* InetAddress.getByName().
*/
int index = address.indexOf('/');
if (index != -1)
{
address = address.substring(index + 1);
}
}
if (address != null)
{
namingServer.setAddress(address);
}
log.debug(
"Creating connector for address='" + ((address == null) ? "ALL" : address.toString()) + "' port='" + port + "' scheme='" + scheme + "'");
return (namingServer);
}