/** * @return If storm view is configured it returns its URL, otherwise it returns the URL of the Storm UI */ private String getMainPageUrl() throws ServiceNotFoundException, ServiceComponentNotFoundException { final ServiceConfiguration stormViewConfiguration = getServiceConfig(SERVICE_STORM_VIEW); String url = null; if (stormViewConfiguration != null) { try { Map<String, String> confMap = stormViewConfiguration.getConfigurationMap(); url = confMap.get(STORM_VIEW_CONFIGURATION_KEY_STORM_VIEW_URL); } catch (IOException e) { // fail back } } if (url != null) { return url; } else { // just use Storm UI HostPort hostPort = getHostPort(); return "http://" + hostPort.toString(); } }
public StormMetadataService build() throws ServiceNotFoundException, ServiceComponentNotFoundException { return new StormMetadataService(newHttpClient(), getTopologySummaryRestUrl(), getMainPageUrl(), securityContext, getServiceConfig(AMBARI_JSON_CONFIG_STORM_ENV), subject, getComponent(AMBARI_JSON_COMPONENT_STORM_NIMBUS), getComponentProcesses(AMBARI_JSON_COMPONENT_STORM_NIMBUS), getComponent(AMBARI_JSON_COMPONENT_STORM_UI_SERVER), getComponentProcesses(AMBARI_JSON_COMPONENT_STORM_UI_SERVER)); }