List of usage examples for org.apache.hadoop.registry.client.binding RegistryTypeUtils webEndpoint
public static Endpoint webEndpoint(String api, URI... uris)
From source file:org.apache.slider.providers.slideram.SliderAMProviderService.java
License:Apache License
@Override public void applyInitialRegistryDefinitions(URL amWebURI, URL agentOpsURI, URL agentStatusURI, ServiceRecord serviceRecord) throws IOException { super.applyInitialRegistryDefinitions(amWebURI, agentOpsURI, agentStatusURI, serviceRecord); // now publish site.xml files YarnConfiguration defaultYarnConfig = new YarnConfiguration(); amState.getPublishedSliderConfigurations().put(PublishedArtifacts.COMPLETE_CONFIG, new PublishedConfiguration("Complete slider application settings", getConfig(), getConfig())); amState.getPublishedSliderConfigurations().put(PublishedArtifacts.YARN_SITE_CONFIG, new PublishedConfiguration("YARN site settings", ConfigHelper.loadFromResource("yarn-site.xml"), defaultYarnConfig)); amState.getPublishedSliderConfigurations().put(PublishedArtifacts.CORE_SITE_CONFIG, new PublishedConfiguration("Core site settings", ConfigHelper.loadFromResource("core-site.xml"), defaultYarnConfig)); amState.getPublishedSliderConfigurations().put(PublishedArtifacts.HDFS_SITE_CONFIG, new PublishedConfiguration("HDFS site settings", ConfigHelper.loadFromResource("hdfs-site.xml"), new HdfsConfiguration(true))); try {//from w w w .jav a 2 s .c o m URL managementAPI = new URL(amWebURI, SLIDER_PATH_MANAGEMENT); URL registryREST = new URL(amWebURI, SLIDER_PATH_REGISTRY); URL publisherURL = new URL(amWebURI, SLIDER_PATH_PUBLISHER); // Set the configurations URL. String configurationsURL = SliderUtils.appendToURL(publisherURL.toExternalForm(), RestPaths.SLIDER_CONFIGSET); String exportsURL = SliderUtils.appendToURL(publisherURL.toExternalForm(), RestPaths.SLIDER_EXPORTS); serviceRecord.addExternalEndpoint( RegistryTypeUtils.webEndpoint(CustomRegistryConstants.WEB_UI, amWebURI.toURI())); serviceRecord.addExternalEndpoint(RegistryTypeUtils .restEndpoint(CustomRegistryConstants.MANAGEMENT_REST_API, managementAPI.toURI())); serviceRecord.addExternalEndpoint(RegistryTypeUtils .restEndpoint(CustomRegistryConstants.PUBLISHER_REST_API, publisherURL.toURI())); serviceRecord.addExternalEndpoint(RegistryTypeUtils .restEndpoint(CustomRegistryConstants.REGISTRY_REST_API, registryREST.toURI())); serviceRecord.addExternalEndpoint(RegistryTypeUtils.restEndpoint( CustomRegistryConstants.PUBLISHER_CONFIGURATIONS_API, new URI(configurationsURL))); serviceRecord.addExternalEndpoint(RegistryTypeUtils .restEndpoint(CustomRegistryConstants.PUBLISHER_EXPORTS_API, new URI(exportsURL))); } catch (URISyntaxException e) { throw new IOException(e); } }