public JMXServiceURL bindServer(Object server, JMXServiceURL url, Map environment) throws IOException
{
// See javax/management/remote/rmi/package-summary.html
RMIServerImpl rmiServer = (RMIServerImpl)server;
RmiConnectorActivator.log(LogService.LOG_DEBUG,"JMXServiceURL for binding is: '" + url + "'",null);
if (isEncodedForm(url))
{
String path = encodeStub(rmiServer, environment);
return new JMXServiceURL(url.getProtocol(), url.getHost(), url.getPort(), path);
}
String jndiURL = parseJNDIForm(url);
RmiConnectorActivator.log(LogService.LOG_DEBUG,"JMXServiceURL path for binding is: '" + jndiURL + "'", null);
InitialContext ctx = null;
try
{
ctx = new InitialContext(new Hashtable(environment));
boolean rebind = Boolean.valueOf((String)environment.get(RMIConnectorServer.JNDI_REBIND_ATTRIBUTE)).booleanValue();
if (rebind)
ctx.rebind(jndiURL, rmiServer.toStub());
else
ctx.bind(jndiURL, rmiServer.toStub());
RmiConnectorActivator.log(LogService.LOG_DEBUG,"Bound " + rmiServer + " to " + jndiURL, null);
return url;
}
catch (NamingException x)
{