use of org.apache.geode.management.internal.cli.converters.ConnectionEndpointConverter in project geode by apache.
the class StartJConsoleCommand method getJmxServiceUrlAsString.
protected String getJmxServiceUrlAsString(final String member) {
if (StringUtils.isNotBlank(member)) {
ConnectionEndpointConverter converter = new ConnectionEndpointConverter();
try {
ConnectionEndpoint connectionEndpoint = converter.convertFromText(member, ConnectionEndpoint.class, null);
String hostAndPort = connectionEndpoint.getHost() + ":" + connectionEndpoint.getPort();
return String.format("service:jmx:rmi://%s/jndi/rmi://%s/jmxrmi", hostAndPort, hostAndPort);
} catch (Exception e) {
throw new IllegalArgumentException(CliStrings.START_JCONSOLE__CONNECT_BY_MEMBER_NAME_ID_ERROR_MESSAGE);
}
} else {
if (isConnectedAndReady() && (getGfsh().getOperationInvoker() instanceof JmxOperationInvoker)) {
JmxOperationInvoker jmxOperationInvoker = (JmxOperationInvoker) getGfsh().getOperationInvoker();
return ObjectUtils.toString(jmxOperationInvoker.getJmxServiceUrl());
}
}
return null;
}
Aggregations