private String publicPort(String containerName, final String port) {
FabricService fabric = fabricService.get();
Container container = fabric.getContainer(containerName);
ContainerTemplate containerTemplate = new ContainerTemplate(container, fabric.getZooKeeperUser(), fabric.getZookeeperPassword(), false);
return containerTemplate.execute(new JmxTemplateSupport.JmxConnectorCallback<String>() {
@Override
public String doWithJmxConnector(JMXConnector connector) throws Exception {
return connector.getMBeanServerConnection().invoke(new ObjectName("io.fabric8:type=Fabric"), "getPublicPortOnCurrentContainer", new Object[]{new Integer(port)}, new String[]{"int"}).toString();
}
});