id
stringlengths
7
14
text
stringlengths
1
106k
223551095_1692
protected Set<HostGroup> processHostGroups(StackAdvisorRequest request) { Set<HostGroup> resultSet = new HashSet<>(); for (Map.Entry<String, Set<String>> componentHost : request.getHostComponents().entrySet()) { String hostGroupName = componentHost.getKey(); Set<String> components = componentHost.getValue(); if (hostGroupName != null && components != null) { HostGroup hostGroup = new HostGroup(); Set<Map<String, String>> componentsSet = new HashSet<>(); for (String component : components) { Map<String, String> componentMap = new HashMap<>(); componentMap.put("name", component); componentsSet.add(componentMap); } hostGroup.setComponents(componentsSet); hostGroup.setName(hostGroupName); resultSet.add(hostGroup); } } return resultSet; }
223551095_1693
protected void populateStackHierarchy(ObjectNode root) { ObjectNode version = (ObjectNode) root.get("Versions"); TextNode stackName = (TextNode) version.get("stack_name"); TextNode stackVersion = (TextNode) version.get("stack_version"); ObjectNode stackHierarchy = version.putObject("stack_hierarchy"); stackHierarchy.put("stack_name", stackName); ArrayNode parents = stackHierarchy.putArray("stack_versions"); for (String parentVersion : metaInfo.getStackParentVersions(stackName.asText(), stackVersion.asText())) { parents.add(parentVersion); } }
223551095_1694
protected void populateAmbariServerInfo(ObjectNode root) { Map<String, String> serverProperties = metaInfo.getAmbariServerProperties(); if (serverProperties != null && !serverProperties.isEmpty()) { JsonNode serverPropertiesNode = mapper.convertValue(serverProperties, JsonNode.class); root.put(AMBARI_SERVER_PROPERTIES_PROPERTY, serverPropertiesNode); } }
223551095_1695
protected void populateStackHierarchy(ObjectNode root) { ObjectNode version = (ObjectNode) root.get("Versions"); TextNode stackName = (TextNode) version.get("stack_name"); TextNode stackVersion = (TextNode) version.get("stack_version"); ObjectNode stackHierarchy = version.putObject("stack_hierarchy"); stackHierarchy.put("stack_name", stackName); ArrayNode parents = stackHierarchy.putArray("stack_versions"); for (String parentVersion : metaInfo.getStackParentVersions(stackName.asText(), stackVersion.asText())) { parents.add(parentVersion); } }
223551095_1696
void populateAmbariConfiguration(ObjectNode root) { root.put(AMBARI_SERVER_CONFIGURATIONS_PROPERTY, mapper.valueToTree(ambariServerConfigurationHandler.getConfigurations())); }
223551095_1697
void populateAmbariConfiguration(ObjectNode root) { root.put(AMBARI_SERVER_CONFIGURATIONS_PROPERTY, mapper.valueToTree(ambariServerConfigurationHandler.getConfigurations())); }
223551095_1698
public void adviseConfiguration(ClusterTopology clusterTopology, Map<String, Map<String, String>> userProvidedConfigurations) throws ConfigurationTopologyException { StackAdvisorRequest request = createStackAdvisorRequest(clusterTopology, StackAdvisorRequestType.CONFIGURATIONS); try { RecommendationResponse response = stackAdvisorHelper.recommend(request); addAdvisedConfigurationsToTopology(response, clusterTopology, userProvidedConfigurations); } catch (StackAdvisorException e) { throw new ConfigurationTopologyException(RECOMMENDATION_FAILED, e); } catch (IllegalArgumentException e) { throw new ConfigurationTopologyException(INVALID_RESPONSE, e); } }
223551095_1699
public void adviseConfiguration(ClusterTopology clusterTopology, Map<String, Map<String, String>> userProvidedConfigurations) throws ConfigurationTopologyException { StackAdvisorRequest request = createStackAdvisorRequest(clusterTopology, StackAdvisorRequestType.CONFIGURATIONS); try { RecommendationResponse response = stackAdvisorHelper.recommend(request); addAdvisedConfigurationsToTopology(response, clusterTopology, userProvidedConfigurations); } catch (StackAdvisorException e) { throw new ConfigurationTopologyException(RECOMMENDATION_FAILED, e); } catch (IllegalArgumentException e) { throw new ConfigurationTopologyException(INVALID_RESPONSE, e); } }
223551095_1700
public void adviseConfiguration(ClusterTopology clusterTopology, Map<String, Map<String, String>> userProvidedConfigurations) throws ConfigurationTopologyException { StackAdvisorRequest request = createStackAdvisorRequest(clusterTopology, StackAdvisorRequestType.CONFIGURATIONS); try { RecommendationResponse response = stackAdvisorHelper.recommend(request); addAdvisedConfigurationsToTopology(response, clusterTopology, userProvidedConfigurations); } catch (StackAdvisorException e) { throw new ConfigurationTopologyException(RECOMMENDATION_FAILED, e); } catch (IllegalArgumentException e) { throw new ConfigurationTopologyException(INVALID_RESPONSE, e); } }
223551095_1701
public void adviseConfiguration(ClusterTopology clusterTopology, Map<String, Map<String, String>> userProvidedConfigurations) throws ConfigurationTopologyException { StackAdvisorRequest request = createStackAdvisorRequest(clusterTopology, StackAdvisorRequestType.CONFIGURATIONS); try { RecommendationResponse response = stackAdvisorHelper.recommend(request); addAdvisedConfigurationsToTopology(response, clusterTopology, userProvidedConfigurations); } catch (StackAdvisorException e) { throw new ConfigurationTopologyException(RECOMMENDATION_FAILED, e); } catch (IllegalArgumentException e) { throw new ConfigurationTopologyException(INVALID_RESPONSE, e); } }
223551095_1702
public void adviseConfiguration(ClusterTopology clusterTopology, Map<String, Map<String, String>> userProvidedConfigurations) throws ConfigurationTopologyException { StackAdvisorRequest request = createStackAdvisorRequest(clusterTopology, StackAdvisorRequestType.CONFIGURATIONS); try { RecommendationResponse response = stackAdvisorHelper.recommend(request); addAdvisedConfigurationsToTopology(response, clusterTopology, userProvidedConfigurations); } catch (StackAdvisorException e) { throw new ConfigurationTopologyException(RECOMMENDATION_FAILED, e); } catch (IllegalArgumentException e) { throw new ConfigurationTopologyException(INVALID_RESPONSE, e); } }
223551095_1703
public void adviseConfiguration(ClusterTopology clusterTopology, Map<String, Map<String, String>> userProvidedConfigurations) throws ConfigurationTopologyException { StackAdvisorRequest request = createStackAdvisorRequest(clusterTopology, StackAdvisorRequestType.CONFIGURATIONS); try { RecommendationResponse response = stackAdvisorHelper.recommend(request); addAdvisedConfigurationsToTopology(response, clusterTopology, userProvidedConfigurations); } catch (StackAdvisorException e) { throw new ConfigurationTopologyException(RECOMMENDATION_FAILED, e); } catch (IllegalArgumentException e) { throw new ConfigurationTopologyException(INVALID_RESPONSE, e); } }
223551095_1704
@Path("{stackVersionId}/repository_versions") public RepositoryVersionService getRepositoryVersionService(@Context javax.ws.rs.core.Request request, @PathParam("stackVersionId") String stackVersion) { final Map<Resource.Type, String> mapIds = new HashMap<>(); mapIds.put(Resource.Type.Cluster, clusterName); mapIds.put(Resource.Type.ClusterStackVersion, stackVersion); return new RepositoryVersionService(mapIds); }
223551095_1705
public Set<String> getRestartRequiredServicesNames(String stackName, String version) throws AmbariException{ HashSet<String> needRestartServices = new HashSet<>(); Collection<ServiceInfo> serviceInfos = getServices(stackName, version).values(); for (ServiceInfo service : serviceInfos) { Boolean restartRequiredAfterChange = service.isRestartRequiredAfterChange(); if (restartRequiredAfterChange != null && restartRequiredAfterChange) { needRestartServices.add(service.getName()); } } return needRestartServices; }
223551095_1706
public Set<String> getRackSensitiveServicesNames(String stackName, String version) throws AmbariException { HashSet<String> needRestartServices = new HashSet<>(); Collection<ServiceInfo> serviceInfos = getServices(stackName, version).values(); for (ServiceInfo service : serviceInfos) { Boolean restartRequiredAfterRackChange = service.isRestartRequiredAfterRackChange(); if (restartRequiredAfterRackChange != null && restartRequiredAfterRackChange) { needRestartServices.add(service.getName()); } } return needRestartServices; }
223551095_1707
public List<ComponentInfo> getComponentsByService(String stackName, String version, String serviceName) throws AmbariException { ServiceInfo service; try { service = getService(stackName, version, serviceName); } catch (StackAccessException e) { throw new ParentObjectNotFoundException("Parent Service resource doesn't exist. stackName=" + stackName + ", stackVersion=" + version + ", serviceName=" + serviceName); } return service.getComponents(); }
223551095_1708
public ComponentInfo getComponent(String stackName, String version, String serviceName, String componentName) throws AmbariException { ComponentInfo component = getService(stackName, version, serviceName).getComponentByName(componentName); if (component == null) { throw new StackAccessException("stackName=" + stackName + ", stackVersion=" + version + ", serviceName=" + serviceName + ", componentName=" + componentName); } return component; }
223551095_1709
public Map<String, List<RepositoryInfo>> getRepository(String stackName, String version) throws AmbariException { StackInfo stack = getStack(stackName, version); List<RepositoryInfo> repository = stack.getRepositories(); Map<String, List<RepositoryInfo>> reposResult = new HashMap<>(); for (RepositoryInfo repo : repository) { if (!reposResult.containsKey(repo.getOsType())) { reposResult.put(repo.getOsType(), new ArrayList<>()); } reposResult.get(repo.getOsType()).add(repo); } return reposResult; }
223551095_1710
public List<RepositoryInfo> getRepositories(String stackName, String version, String osType) throws AmbariException { StackInfo stack = getStack(stackName, version); List<RepositoryInfo> repositories = stack.getRepositories(); List<RepositoryInfo> repositoriesResult = new ArrayList<>(); for (RepositoryInfo repository : repositories) { if (repository.getOsType().equals(osType)) { repositoriesResult.add(repository); } } return repositoriesResult; }
223551095_1711
public boolean isSupportedStack(String stackName, String version) { try { // thrown an exception if the stack doesn't exist getStack(stackName, version); return true; } catch (AmbariException e) { return false; } }
223551095_1712
public boolean isValidService(String stackName, String version, String serviceName){ try { getService(stackName, version, serviceName); return true; } catch (AmbariException e) { return false; } }
223551095_1713
public boolean isServiceWithNoConfigs(String stackName, String version, String serviceName) throws AmbariException{ StackInfo stack = getStack(stackName, version); List<String> servicesWithNoConfigs = stack.getServicesWithNoConfigs(); return servicesWithNoConfigs.contains(serviceName); }
223551095_1714
public String getComponentToService(String stackName, String version, String componentName) throws AmbariException { if (LOG.isDebugEnabled()) { LOG.debug("Looking for service for component, stackName={}, stackVersion={}, componentName={}", stackName, version, componentName); } Map<String, ServiceInfo> services = getServices(stackName, version); String retService = null; if (services == null || services.isEmpty()) { return retService; } for (Map.Entry<String, ServiceInfo> entry : services.entrySet()) { ComponentInfo vu = entry.getValue().getComponentByName(componentName); if(vu != null){ retService = entry.getKey(); break; } } return retService; }
223551095_1715
public Map<String, ServiceInfo> getServices(String stackName, String version) throws AmbariException { Map<String, ServiceInfo> servicesInfoResult = new HashMap<>(); Collection<ServiceInfo> services; StackInfo stack; try { stack = getStack(stackName, version); } catch (StackAccessException e) { throw new ParentObjectNotFoundException("Parent Stack Version resource doesn't exist", e); } services = stack.getServices(); if (services != null) { for (ServiceInfo service : services) { servicesInfoResult.put(service.getName(), service); } } return servicesInfoResult; }
223551095_1716
public ServiceInfo getService(Service service) throws AmbariException { StackId stackId = service.getDesiredStackId(); return getService(stackId.getStackName(), stackId.getStackVersion(), service.getName()); }
223551095_1717
public ServiceInfo getService(Service service) throws AmbariException { StackId stackId = service.getDesiredStackId(); return getService(stackId.getStackName(), stackId.getStackVersion(), service.getName()); }
223551095_1718
public Map<String, List<RepositoryInfo>> getRepository(String stackName, String version) throws AmbariException { StackInfo stack = getStack(stackName, version); List<RepositoryInfo> repository = stack.getRepositories(); Map<String, List<RepositoryInfo>> reposResult = new HashMap<>(); for (RepositoryInfo repo : repository) { if (!reposResult.containsKey(repo.getOsType())) { reposResult.put(repo.getOsType(), new ArrayList<>()); } reposResult.get(repo.getOsType()).add(repo); } return reposResult; }
223551095_1719
public ServiceInfo getService(Service service) throws AmbariException { StackId stackId = service.getDesiredStackId(); return getService(stackId.getStackName(), stackId.getStackVersion(), service.getName()); }
223551095_1720
public ComponentInfo getComponent(String stackName, String version, String serviceName, String componentName) throws AmbariException { ComponentInfo component = getService(stackName, version, serviceName).getComponentByName(componentName); if (component == null) { throw new StackAccessException("stackName=" + stackName + ", stackVersion=" + version + ", serviceName=" + serviceName + ", componentName=" + componentName); } return component; }
223551095_1721
public List<RepositoryInfo> getRepositories(String stackName, String version, String osType) throws AmbariException { StackInfo stack = getStack(stackName, version); List<RepositoryInfo> repositories = stack.getRepositories(); List<RepositoryInfo> repositoriesResult = new ArrayList<>(); for (RepositoryInfo repository : repositories) { if (repository.getOsType().equals(osType)) { repositoriesResult.add(repository); } } return repositoriesResult; }
223551095_1722
public Map<String, List<RepositoryInfo>> getRepository(String stackName, String version) throws AmbariException { StackInfo stack = getStack(stackName, version); List<RepositoryInfo> repository = stack.getRepositories(); Map<String, List<RepositoryInfo>> reposResult = new HashMap<>(); for (RepositoryInfo repo : repository) { if (!reposResult.containsKey(repo.getOsType())) { reposResult.put(repo.getOsType(), new ArrayList<>()); } reposResult.get(repo.getOsType()).add(repo); } return reposResult; }
223551095_1723
public ServiceInfo getService(Service service) throws AmbariException { StackId stackId = service.getDesiredStackId(); return getService(stackId.getStackName(), stackId.getStackVersion(), service.getName()); }
223551095_1724
public Collection<StackInfo> getStacks() { return stackManager.getStacks(); }
223551095_1725
public StackInfo getStack(StackId stackId) throws AmbariException { return getStack(stackId.getStackName(), stackId.getStackVersion()); }
223551095_1726
public List<String> getStackParentVersions(String stackName, String version) { List<String> parents = new ArrayList<>(); try { StackInfo stackInfo = getStack(stackName, version); String parentVersion = stackInfo.getParentStackVersion(); if (parentVersion != null) { parents.add(parentVersion); parents.addAll(getStackParentVersions(stackName, parentVersion)); } } catch (AmbariException e) { // parent was not found. } return parents; }
223551095_1727
public Set<PropertyInfo> getServiceProperties(String stackName, String version, String serviceName) throws AmbariException { return new HashSet<>(getService(stackName, version, serviceName).getProperties()); }
223551095_1728
public Set<PropertyInfo> getPropertiesByName(String stackName, String version, String serviceName, String propertyName) throws AmbariException { Set<PropertyInfo> properties = serviceName == null ? getStackProperties(stackName, version) : getServiceProperties(stackName, version, serviceName); if (properties.size() == 0) { throw new StackAccessException("stackName=" + stackName + ", stackVersion=" + version + ", serviceName=" + serviceName + ", propertyName=" + propertyName); } Set<PropertyInfo> propertyResult = new HashSet<>(); for (PropertyInfo property : properties) { if (property.getName().equals(propertyName)) { propertyResult.add(property); } } if (propertyResult.isEmpty()) { throw new StackAccessException("stackName=" + stackName + ", stackVersion=" + version + ", serviceName=" + serviceName + ", propertyName=" + propertyName); } return propertyResult; }
223551095_1729
public Set<PropertyInfo> getPropertiesByName(String stackName, String version, String serviceName, String propertyName) throws AmbariException { Set<PropertyInfo> properties = serviceName == null ? getStackProperties(stackName, version) : getServiceProperties(stackName, version, serviceName); if (properties.size() == 0) { throw new StackAccessException("stackName=" + stackName + ", stackVersion=" + version + ", serviceName=" + serviceName + ", propertyName=" + propertyName); } Set<PropertyInfo> propertyResult = new HashSet<>(); for (PropertyInfo property : properties) { if (property.getName().equals(propertyName)) { propertyResult.add(property); } } if (propertyResult.isEmpty()) { throw new StackAccessException("stackName=" + stackName + ", stackVersion=" + version + ", serviceName=" + serviceName + ", propertyName=" + propertyName); } return propertyResult; }
223551095_1730
public Set<OperatingSystemInfo> getOperatingSystems(String stackName, String version) throws AmbariException { Set<OperatingSystemInfo> operatingSystems = new HashSet<>(); StackInfo stack = getStack(stackName, version); List<RepositoryInfo> repositories = stack.getRepositories(); for (RepositoryInfo repository : repositories) { operatingSystems.add(new OperatingSystemInfo(repository.getOsType())); } return operatingSystems; }
223551095_1731
public OperatingSystemInfo getOperatingSystem(String stackName, String version, String osType) throws AmbariException { Set<OperatingSystemInfo> operatingSystems = getOperatingSystems(stackName, version); if (operatingSystems.size() == 0) { throw new StackAccessException("stackName=" + stackName + ", stackVersion=" + version + ", osType=" + osType); } OperatingSystemInfo resultOperatingSystem = null; for (OperatingSystemInfo operatingSystem : operatingSystems) { if (operatingSystem.getOsType().equals(osType)) { resultOperatingSystem = operatingSystem; break; } } if (resultOperatingSystem == null) { throw new StackAccessException("stackName=" + stackName + ", stackVersion=" + version + ", osType=" + osType); } return resultOperatingSystem; }
223551095_1732
public boolean isOsSupported(String osType) { return ALL_SUPPORTED_OS.contains(osType); }
223551095_1733
public Set<PropertyInfo> getServiceProperties(String stackName, String version, String serviceName) throws AmbariException { return new HashSet<>(getService(stackName, version, serviceName).getProperties()); }
223551095_1734
public ServiceInfo getService(Service service) throws AmbariException { StackId stackId = service.getDesiredStackId(); return getService(stackId.getStackName(), stackId.getStackVersion(), service.getName()); }
223551095_1735
public ServiceInfo getService(Service service) throws AmbariException { StackId stackId = service.getDesiredStackId(); return getService(stackId.getStackName(), stackId.getStackVersion(), service.getName()); }
223551095_1736
public ServiceInfo getService(Service service) throws AmbariException { StackId stackId = service.getDesiredStackId(); return getService(stackId.getStackName(), stackId.getStackVersion(), service.getName()); }
223551095_1737
public ServiceInfo getService(Service service) throws AmbariException { StackId stackId = service.getDesiredStackId(); return getService(stackId.getStackName(), stackId.getStackVersion(), service.getName()); }
223551095_1738
public ServiceInfo getService(Service service) throws AmbariException { StackId stackId = service.getDesiredStackId(); return getService(stackId.getStackName(), stackId.getStackVersion(), service.getName()); }
223551095_1739
public ServiceInfo getService(Service service) throws AmbariException { StackId stackId = service.getDesiredStackId(); return getService(stackId.getStackName(), stackId.getStackVersion(), service.getName()); }
223551095_1740
public ServiceInfo getService(Service service) throws AmbariException { StackId stackId = service.getDesiredStackId(); return getService(stackId.getStackName(), stackId.getStackVersion(), service.getName()); }
223551095_1741
public ServiceInfo getService(Service service) throws AmbariException { StackId stackId = service.getDesiredStackId(); return getService(stackId.getStackName(), stackId.getStackVersion(), service.getName()); }
223551095_1742
public ServiceInfo getService(Service service) throws AmbariException { StackId stackId = service.getDesiredStackId(); return getService(stackId.getStackName(), stackId.getStackVersion(), service.getName()); }
223551095_1743
public ServiceInfo getService(Service service) throws AmbariException { StackId stackId = service.getDesiredStackId(); return getService(stackId.getStackName(), stackId.getStackVersion(), service.getName()); }
223551095_1744
public ServiceInfo getService(Service service) throws AmbariException { StackId stackId = service.getDesiredStackId(); return getService(stackId.getStackName(), stackId.getStackVersion(), service.getName()); }
223551095_1745
public ServiceInfo getService(Service service) throws AmbariException { StackId stackId = service.getDesiredStackId(); return getService(stackId.getStackName(), stackId.getStackVersion(), service.getName()); }
223551095_1746
public ServiceInfo getService(Service service) throws AmbariException { StackId stackId = service.getDesiredStackId(); return getService(stackId.getStackName(), stackId.getStackVersion(), service.getName()); }
223551095_1747
public ServiceInfo getService(Service service) throws AmbariException { StackId stackId = service.getDesiredStackId(); return getService(stackId.getStackName(), stackId.getStackVersion(), service.getName()); }
223551095_1748
public ComponentInfo getComponent(String stackName, String version, String serviceName, String componentName) throws AmbariException { ComponentInfo component = getService(stackName, version, serviceName).getComponentByName(componentName); if (component == null) { throw new StackAccessException("stackName=" + stackName + ", stackVersion=" + version + ", serviceName=" + serviceName + ", componentName=" + componentName); } return component; }
223551095_1749
public ServiceInfo getService(Service service) throws AmbariException { StackId stackId = service.getDesiredStackId(); return getService(stackId.getStackName(), stackId.getStackVersion(), service.getName()); }
223551095_1750
public ComponentInfo getComponent(String stackName, String version, String serviceName, String componentName) throws AmbariException { ComponentInfo component = getService(stackName, version, serviceName).getComponentByName(componentName); if (component == null) { throw new StackAccessException("stackName=" + stackName + ", stackVersion=" + version + ", serviceName=" + serviceName + ", componentName=" + componentName); } return component; }
223551095_1751
public ServiceInfo getService(Service service) throws AmbariException { StackId stackId = service.getDesiredStackId(); return getService(stackId.getStackName(), stackId.getStackVersion(), service.getName()); }
223551095_1752
public ServiceInfo getService(Service service) throws AmbariException { StackId stackId = service.getDesiredStackId(); return getService(stackId.getStackName(), stackId.getStackVersion(), service.getName()); }
223551095_1753
public ServiceInfo getService(Service service) throws AmbariException { StackId stackId = service.getDesiredStackId(); return getService(stackId.getStackName(), stackId.getStackVersion(), service.getName()); }
223551095_1754
public DependencyInfo getComponentDependency(String stackName, String version, String service, String component, String dependencyName) throws AmbariException { DependencyInfo foundDependency = null; List<DependencyInfo> componentDependencies = getComponentDependencies( stackName, version, service, component); Iterator<DependencyInfo> iter = componentDependencies.iterator(); while (foundDependency == null && iter.hasNext()) { DependencyInfo dependency = iter.next(); if (dependencyName.equals(dependency.getComponentName())) { foundDependency = dependency; } } if (foundDependency == null) { throw new StackAccessException("stackName=" + stackName + ", stackVersion= " + version + ", stackService=" + service + ", stackComponent= " + component + ", dependency=" + dependencyName); } return foundDependency; }
223551095_1755
public List<DependencyInfo> getComponentDependencies(String stackName, String version, String service, String component) throws AmbariException { ComponentInfo componentInfo; try { componentInfo = getComponent(stackName, version, service, component); } catch (StackAccessException e) { throw new ParentObjectNotFoundException("Parent Component resource doesn't exist", e); } return componentInfo.getDependencies(); }
223551095_1756
public ServiceInfo getService(Service service) throws AmbariException { StackId stackId = service.getDesiredStackId(); return getService(stackId.getStackName(), stackId.getStackVersion(), service.getName()); }
223551095_1757
public void reconcileAlertDefinitions(Clusters clusters, boolean updateScriptPaths) throws AmbariException { Map<String, Cluster> clusterMap = clusters.getClusters(); if (null == clusterMap || clusterMap.size() == 0) { return; } // for every cluster for (Cluster cluster : clusterMap.values()) { reconcileAlertDefinitions(cluster, updateScriptPaths); } }
223551095_1758
public void reconcileAlertDefinitions(Clusters clusters, boolean updateScriptPaths) throws AmbariException { Map<String, Cluster> clusterMap = clusters.getClusters(); if (null == clusterMap || clusterMap.size() == 0) { return; } // for every cluster for (Cluster cluster : clusterMap.values()) { reconcileAlertDefinitions(cluster, updateScriptPaths); } }
223551095_1759
public ServiceInfo getService(Service service) throws AmbariException { StackId stackId = service.getDesiredStackId(); return getService(stackId.getStackName(), stackId.getStackVersion(), service.getName()); }
223551095_1760
KerberosDescriptor readKerberosDescriptorFromFile(String fileLocation) throws AmbariException { if (!StringUtils.isEmpty(fileLocation)) { File file = new File(fileLocation); if (file.canRead()) { try { return kerberosDescriptorFactory.createInstance(file); } catch (IOException e) { throw new AmbariException(String.format("Failed to parse Kerberos descriptor file %s", file.getAbsolutePath()), e); } } else { throw new AmbariException(String.format("Unable to read Kerberos descriptor file %s", file.getAbsolutePath())); } } else { LOG.debug("Missing path to Kerberos descriptor, returning null"); } return null; }
223551095_1761
public KerberosDescriptor getKerberosDescriptor(String stackName, String stackVersion, boolean includePreconfigureData) throws AmbariException { StackInfo stackInfo = getStack(stackName, stackVersion); KerberosDescriptor kerberosDescriptor = readKerberosDescriptorFromFile(getCommonKerberosDescriptorFileLocation()); if (kerberosDescriptor == null) { LOG.warn("Couldn't read common Kerberos descriptor with path {%s}", getCommonKerberosDescriptorFileLocation()); kerberosDescriptor = new KerberosDescriptor(); } // Read in the stack-level Kerberos descriptor pre-configuration data if (includePreconfigureData) { KerberosDescriptor preConfigureKerberosDescriptor = readKerberosDescriptorFromFile(stackInfo.getKerberosDescriptorPreConfigurationFileLocation()); if (preConfigureKerberosDescriptor != null) { // Ensure the all services to be pre-configured are flagged appropriately. Map<String, KerberosServiceDescriptor> serviceDescriptors = preConfigureKerberosDescriptor.getServices(); if (serviceDescriptors != null) { for (KerberosServiceDescriptor serviceDescriptor : serviceDescriptors.values()) { serviceDescriptor.setPreconfigure(true); } } kerberosDescriptor.update(preConfigureKerberosDescriptor); } } // Read in the individual service-level Kerberos descriptors Map<String, ServiceInfo> services = getServices(stackName, stackVersion); if (services != null) { for (ServiceInfo service : services.values()) { KerberosServiceDescriptor[] serviceDescriptors = getKerberosDescriptor(service); if (serviceDescriptors != null) { for (KerberosServiceDescriptor serviceDescriptor : serviceDescriptors) { // Add the service-level Kerberos descriptor to kerberosDescriptor. If the service was // previously added (possible from the pre-configure data), update the existing service-level // Kerberos descriptor with this one. kerberosDescriptor.putService(serviceDescriptor); } } } } return kerberosDescriptor; }
223551095_1762
public File getCommonWidgetsDescriptorFile() { return commonWidgetsDescriptorFile; }
223551095_1764
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; NamedPropertySet that = (NamedPropertySet) o; return (m_mapProperties == null ? that.m_mapProperties == null : m_mapProperties.equals(that.m_mapProperties)) && (m_name == null ? that.m_name == null : m_name.equals(that.m_name)); }
223551095_1765
@Override public int hashCode() { int result = m_name != null ? m_name.hashCode() : 0; result = 31 * result + (m_mapProperties != null ? m_mapProperties.hashCode() : 0); return result; }
223551095_1766
public List<Order> buildSortOrders(SortRequest sortRequest, JpaPredicateVisitor<T> visitor) { if (null == sortRequest || null == sortRequest.getProperties()) { return Collections.emptyList(); } CriteriaBuilder builder = visitor.getCriteriaBuilder(); List<SortRequestProperty> sortProperties = sortRequest.getProperties(); List<Order> sortOrders = new ArrayList<>(sortProperties.size()); for (SortRequestProperty sort : sortProperties) { String propertyId = sort.getPropertyId(); List<? extends SingularAttribute<?, ?>> singularAttributes = visitor.getPredicateMapping(propertyId); if (null == singularAttributes || singularAttributes.size() == 0) { continue; } Path<?> path = null; for (SingularAttribute<?, ?> singularAttribute : singularAttributes) { if (null == path) { CriteriaQuery<T> query = visitor.getCriteriaQuery(); Set<Root<?>> roots = query.getRoots(); // if there are existing roots; use the existing roots to prevent more // roots from being added potentially causing a cartesian product // where we don't want one if (null != roots && !roots.isEmpty()) { Iterator<Root<?>> iterator = roots.iterator(); while (iterator.hasNext()) { Root<?> root = iterator.next(); Class<?> visitorEntityClass = visitor.getEntityClass(); if (ObjectUtils.equals(visitorEntityClass, root.getJavaType()) || ObjectUtils.equals(visitorEntityClass, root.getModel().getJavaType())) { path = root.get(singularAttribute.getName()); break; } } } // no roots exist already which match this entity class, create a new // path if (null == path) { path = query.from(visitor.getEntityClass()).get(singularAttribute.getName()); } } else { path = path.get(singularAttribute.getName()); } } Order sortOrder = null; if (sort.getOrder() == org.apache.ambari.server.controller.spi.SortRequest.Order.ASC) { sortOrder = builder.asc(path); } else { sortOrder = builder.desc(path); } sortOrders.add(sortOrder); } return sortOrders; }
223551095_1768
public Predicate getProcessedPredicate() { return lastVisited; }
223551095_1769
public Set<String> getSubResourceCategories() { return subResourceCategories; }
223551095_1770
public Set<String> getSubResourceCategories() { return subResourceCategories; }
223551095_1771
public Set<String> getSubResourceProperties() { return subResourceProperties; }
223551095_1772
public Set<String> getProperties() { return m_properties; }
223551095_1773
public ResourceDefinition getResource() { return m_resource; }
223551095_1774
@Override public TreeNode<Set<String>> finalizeProperties( TreeNode<QueryInfo> queryTree, boolean isCollection) { QueryInfo queryInfo = queryTree.getObject(); TreeNode<Set<String>> resultTree = new TreeNodeImpl<>( null, queryInfo.getProperties(), queryTree.getName()); copyPropertiesToResult(queryTree, resultTree); m_rootType = queryTree.getObject().getResource().getType(); m_isCollection = isCollection; boolean addKeysToEmptyResource = true; if (! isCollection && isRequestWithNoProperties(queryTree)) { addSubResources(queryTree, resultTree); addKeysToEmptyResource = false; } processRequestedProperties(queryTree); ensureRequiredProperties(resultTree, addKeysToEmptyResource); return resultTree; }
223551095_1775
@Override public TreeNode<Set<String>> finalizeProperties( TreeNode<QueryInfo> queryTree, boolean isCollection) { QueryInfo queryInfo = queryTree.getObject(); TreeNode<Set<String>> resultTree = new TreeNodeImpl<>( null, queryInfo.getProperties(), queryTree.getName()); copyPropertiesToResult(queryTree, resultTree); m_rootType = queryTree.getObject().getResource().getType(); m_isCollection = isCollection; boolean addKeysToEmptyResource = true; if (! isCollection && isRequestWithNoProperties(queryTree)) { addSubResources(queryTree, resultTree); addKeysToEmptyResource = false; } processRequestedProperties(queryTree); ensureRequiredProperties(resultTree, addKeysToEmptyResource); return resultTree; }
223551095_1776
@Override public TreeNode<Set<String>> finalizeProperties( TreeNode<QueryInfo> queryTree, boolean isCollection) { QueryInfo queryInfo = queryTree.getObject(); TreeNode<Set<String>> resultTree = new TreeNodeImpl<>( null, queryInfo.getProperties(), queryTree.getName()); copyPropertiesToResult(queryTree, resultTree); m_rootType = queryTree.getObject().getResource().getType(); m_isCollection = isCollection; boolean addKeysToEmptyResource = true; if (! isCollection && isRequestWithNoProperties(queryTree)) { addSubResources(queryTree, resultTree); addKeysToEmptyResource = false; } processRequestedProperties(queryTree); ensureRequiredProperties(resultTree, addKeysToEmptyResource); return resultTree; }
223551095_1777
@Override public TreeNode<Set<String>> finalizeProperties( TreeNode<QueryInfo> queryTree, boolean isCollection) { QueryInfo queryInfo = queryTree.getObject(); TreeNode<Set<String>> resultTree = new TreeNodeImpl<>( null, queryInfo.getProperties(), queryTree.getName()); copyPropertiesToResult(queryTree, resultTree); m_rootType = queryTree.getObject().getResource().getType(); m_isCollection = isCollection; boolean addKeysToEmptyResource = true; if (! isCollection && isRequestWithNoProperties(queryTree)) { addSubResources(queryTree, resultTree); addKeysToEmptyResource = false; } processRequestedProperties(queryTree); ensureRequiredProperties(resultTree, addKeysToEmptyResource); return resultTree; }
223551095_1778
@Override public TreeNode<Set<String>> finalizeProperties( TreeNode<QueryInfo> queryTree, boolean isCollection) { QueryInfo queryInfo = queryTree.getObject(); TreeNode<Set<String>> resultTree = new TreeNodeImpl<>( null, queryInfo.getProperties(), queryTree.getName()); copyPropertiesToResult(queryTree, resultTree); m_rootType = queryTree.getObject().getResource().getType(); m_isCollection = isCollection; boolean addKeysToEmptyResource = true; if (! isCollection && isRequestWithNoProperties(queryTree)) { addSubResources(queryTree, resultTree); addKeysToEmptyResource = false; } processRequestedProperties(queryTree); ensureRequiredProperties(resultTree, addKeysToEmptyResource); return resultTree; }
223551095_1779
@Override public TreeNode<Set<String>> finalizeProperties( TreeNode<QueryInfo> queryTree, boolean isCollection) { QueryInfo queryInfo = queryTree.getObject(); TreeNode<Set<String>> resultTree = new TreeNodeImpl<>( null, queryInfo.getProperties(), queryTree.getName()); copyPropertiesToResult(queryTree, resultTree); m_rootType = queryTree.getObject().getResource().getType(); m_isCollection = isCollection; boolean addKeysToEmptyResource = true; if (! isCollection && isRequestWithNoProperties(queryTree)) { addSubResources(queryTree, resultTree); addKeysToEmptyResource = false; } processRequestedProperties(queryTree); ensureRequiredProperties(resultTree, addKeysToEmptyResource); return resultTree; }
223551095_1780
@Override public TreeNode<Set<String>> finalizeProperties( TreeNode<QueryInfo> queryTree, boolean isCollection) { QueryInfo queryInfo = queryTree.getObject(); TreeNode<Set<String>> resultTree = new TreeNodeImpl<>( null, queryInfo.getProperties(), queryTree.getName()); copyPropertiesToResult(queryTree, resultTree); m_rootType = queryTree.getObject().getResource().getType(); m_isCollection = isCollection; boolean addKeysToEmptyResource = true; if (! isCollection && isRequestWithNoProperties(queryTree)) { addSubResources(queryTree, resultTree); addKeysToEmptyResource = false; } processRequestedProperties(queryTree); ensureRequiredProperties(resultTree, addKeysToEmptyResource); return resultTree; }
223551095_1781
@Override public TreeNode<Set<String>> finalizeProperties( TreeNode<QueryInfo> queryTree, boolean isCollection) { QueryInfo queryInfo = queryTree.getObject(); TreeNode<Set<String>> resultTree = new TreeNodeImpl<>( null, queryInfo.getProperties(), queryTree.getName()); copyPropertiesToResult(queryTree, resultTree); m_rootType = queryTree.getObject().getResource().getType(); m_isCollection = isCollection; boolean addKeysToEmptyResource = true; if (! isCollection && isRequestWithNoProperties(queryTree)) { addSubResources(queryTree, resultTree); addKeysToEmptyResource = false; } processRequestedProperties(queryTree); ensureRequiredProperties(resultTree, addKeysToEmptyResource); return resultTree; }
223551095_1783
@Override public TreeNode<Set<String>> finalizeProperties( TreeNode<QueryInfo> queryTree, boolean isCollection) { QueryInfo queryInfo = queryTree.getObject(); TreeNode<Set<String>> resultTree = new TreeNodeImpl<>( null, queryInfo.getProperties(), queryTree.getName()); copyPropertiesToResult(queryTree, resultTree); boolean addKeysToEmptyResource = true; if (! isCollection && isRequestWithNoProperties(queryTree)) { addSubResources(queryTree, resultTree); addKeysToEmptyResource = false; } ensureRequiredProperties(resultTree, addKeysToEmptyResource); return resultTree; }
223551095_1784
@Override public TreeNode<Set<String>> finalizeProperties( TreeNode<QueryInfo> queryTree, boolean isCollection) { QueryInfo queryInfo = queryTree.getObject(); TreeNode<Set<String>> resultTree = new TreeNodeImpl<>( null, queryInfo.getProperties(), queryTree.getName()); copyPropertiesToResult(queryTree, resultTree); boolean addKeysToEmptyResource = true; if (! isCollection && isRequestWithNoProperties(queryTree)) { addSubResources(queryTree, resultTree); addKeysToEmptyResource = false; } ensureRequiredProperties(resultTree, addKeysToEmptyResource); return resultTree; }
223551095_1785
@Override public TreeNode<Set<String>> finalizeProperties( TreeNode<QueryInfo> queryTree, boolean isCollection) { QueryInfo queryInfo = queryTree.getObject(); TreeNode<Set<String>> resultTree = new TreeNodeImpl<>( null, queryInfo.getProperties(), queryTree.getName()); copyPropertiesToResult(queryTree, resultTree); boolean addKeysToEmptyResource = true; if (! isCollection && isRequestWithNoProperties(queryTree)) { addSubResources(queryTree, resultTree); addKeysToEmptyResource = false; } ensureRequiredProperties(resultTree, addKeysToEmptyResource); return resultTree; }
223551095_1786
@Override public TreeNode<Set<String>> finalizeProperties( TreeNode<QueryInfo> queryTree, boolean isCollection) { QueryInfo queryInfo = queryTree.getObject(); TreeNode<Set<String>> resultTree = new TreeNodeImpl<>( null, queryInfo.getProperties(), queryTree.getName()); copyPropertiesToResult(queryTree, resultTree); boolean addKeysToEmptyResource = true; if (! isCollection && isRequestWithNoProperties(queryTree)) { addSubResources(queryTree, resultTree); addKeysToEmptyResource = false; } ensureRequiredProperties(resultTree, addKeysToEmptyResource); return resultTree; }
223551095_1787
@Override public TreeNode<Set<String>> finalizeProperties( TreeNode<QueryInfo> queryTree, boolean isCollection) { QueryInfo queryInfo = queryTree.getObject(); TreeNode<Set<String>> resultTree = new TreeNodeImpl<>( null, queryInfo.getProperties(), queryTree.getName()); copyPropertiesToResult(queryTree, resultTree); boolean addKeysToEmptyResource = true; if (! isCollection && isRequestWithNoProperties(queryTree)) { addSubResources(queryTree, resultTree); addKeysToEmptyResource = false; } ensureRequiredProperties(resultTree, addKeysToEmptyResource); return resultTree; }
223551095_1788
@Override public TreeNode<Set<String>> finalizeProperties( TreeNode<QueryInfo> queryTree, boolean isCollection) { QueryInfo queryInfo = queryTree.getObject(); TreeNode<Set<String>> resultTree = new TreeNodeImpl<>( null, queryInfo.getProperties(), queryTree.getName()); copyPropertiesToResult(queryTree, resultTree); boolean addKeysToEmptyResource = true; if (! isCollection && isRequestWithNoProperties(queryTree)) { addSubResources(queryTree, resultTree); addKeysToEmptyResource = false; } ensureRequiredProperties(resultTree, addKeysToEmptyResource); return resultTree; }
223551095_1789
@Override public TreeNode<Set<String>> finalizeProperties( TreeNode<QueryInfo> queryTree, boolean isCollection) { QueryInfo queryInfo = queryTree.getObject(); TreeNode<Set<String>> resultTree = new TreeNodeImpl<>( null, queryInfo.getProperties(), queryTree.getName()); copyPropertiesToResult(queryTree, resultTree); boolean addKeysToEmptyResource = true; if (! isCollection && isRequestWithNoProperties(queryTree)) { addSubResources(queryTree, resultTree); addKeysToEmptyResource = false; } ensureRequiredProperties(resultTree, addKeysToEmptyResource); return resultTree; }
223551095_1790
@Override public TreeNode<Set<String>> finalizeProperties( TreeNode<QueryInfo> queryTree, boolean isCollection) { QueryInfo queryInfo = queryTree.getObject(); TreeNode<Set<String>> resultTree = new TreeNodeImpl<>( null, queryInfo.getProperties(), queryTree.getName()); copyPropertiesToResult(queryTree, resultTree); boolean addKeysToEmptyResource = true; if (! isCollection && isRequestWithNoProperties(queryTree)) { addSubResources(queryTree, resultTree); addKeysToEmptyResource = false; } ensureRequiredProperties(resultTree, addKeysToEmptyResource); return resultTree; }
223551095_1792
@Override public TreeNode<Set<String>> finalizeProperties(TreeNode<QueryInfo> queryProperties, boolean isCollection) { Set<String> properties = queryProperties.getObject().getProperties(); if (properties != null) { properties.add("params/padding/" + paddingMethod.name()); } return super.finalizeProperties(queryProperties, isCollection); }
223551095_1793
@Override public TreeNode<Set<String>> finalizeProperties( TreeNode<QueryInfo> queryProperties, boolean isCollection) { Set<String> properties = new HashSet<>(queryProperties.getObject().getProperties()); TreeNode<Set<String>> resultTree = new TreeNodeImpl<>( null, properties, queryProperties.getName()); copyPropertiesToResult(queryProperties, resultTree); String configType = Resource.Type.Configuration.name(); if (resultTree.getChild(configType) == null) { resultTree.addChild(new HashSet<>(), configType); } String serviceType = Resource.Type.Service.name(); if (resultTree.getChild(serviceType) == null) { resultTree.addChild(new HashSet<>(), serviceType); } TreeNode<Set<String>> serviceNode = resultTree.getChild(serviceType); if (serviceNode == null) { serviceNode = resultTree.addChild(new HashSet<>(), serviceType); } String serviceComponentType = Resource.Type.Component.name(); TreeNode<Set<String>> serviceComponentNode = resultTree.getChild( serviceType + "/" + serviceComponentType); if (serviceComponentNode == null) { serviceComponentNode = serviceNode.addChild(new HashSet<>(), serviceComponentType); } serviceComponentNode.getObject().add("ServiceComponentInfo/cluster_name"); serviceComponentNode.getObject().add("ServiceComponentInfo/service_name"); serviceComponentNode.getObject().add("ServiceComponentInfo/component_name"); serviceComponentNode.getObject().add("ServiceComponentInfo/recovery_enabled"); String hostType = Resource.Type.Host.name(); String hostComponentType = Resource.Type.HostComponent.name(); TreeNode<Set<String>> hostComponentNode = resultTree.getChild( hostType + "/" + hostComponentType); if (hostComponentNode == null) { TreeNode<Set<String>> hostNode = resultTree.getChild(hostType); if (hostNode == null) { hostNode = resultTree.addChild(new HashSet<>(), hostType); } hostComponentNode = hostNode.addChild(new HashSet<>(), hostComponentType); } resultTree.getChild(configType).getObject().add("properties"); hostComponentNode.getObject().add("HostRoles/component_name"); return resultTree; }
223551095_1794
@Override public Result finalizeResult(Result queryResult) { TreeNode<Resource> resultTree = queryResult.getResultTree(); Result result = new ResultImpl(true); TreeNode<Resource> blueprintResultTree = result.getResultTree(); if (isCollection(resultTree)) { blueprintResultTree.setProperty("isCollection", "true"); } for (TreeNode<Resource> node : resultTree.getChildren()) { Resource blueprintResource = createBlueprintResource(node); blueprintResultTree.addChild(new TreeNodeImpl<>( blueprintResultTree, blueprintResource, node.getName())); } return result; }
223551095_1795
@Override public TreeNode<Set<String>> finalizeProperties( TreeNode<QueryInfo> queryProperties, boolean isCollection) { Set<String> properties = new HashSet<>(queryProperties.getObject().getProperties()); TreeNode<Set<String>> resultTree = new TreeNodeImpl<>( null, properties, queryProperties.getName()); copyPropertiesToResult(queryProperties, resultTree); String configType = Resource.Type.Configuration.name(); if (resultTree.getChild(configType) == null) { resultTree.addChild(new HashSet<>(), configType); } String serviceType = Resource.Type.Service.name(); if (resultTree.getChild(serviceType) == null) { resultTree.addChild(new HashSet<>(), serviceType); } TreeNode<Set<String>> serviceNode = resultTree.getChild(serviceType); if (serviceNode == null) { serviceNode = resultTree.addChild(new HashSet<>(), serviceType); } String serviceComponentType = Resource.Type.Component.name(); TreeNode<Set<String>> serviceComponentNode = resultTree.getChild( serviceType + "/" + serviceComponentType); if (serviceComponentNode == null) { serviceComponentNode = serviceNode.addChild(new HashSet<>(), serviceComponentType); } serviceComponentNode.getObject().add("ServiceComponentInfo/cluster_name"); serviceComponentNode.getObject().add("ServiceComponentInfo/service_name"); serviceComponentNode.getObject().add("ServiceComponentInfo/component_name"); serviceComponentNode.getObject().add("ServiceComponentInfo/recovery_enabled"); String hostType = Resource.Type.Host.name(); String hostComponentType = Resource.Type.HostComponent.name(); TreeNode<Set<String>> hostComponentNode = resultTree.getChild( hostType + "/" + hostComponentType); if (hostComponentNode == null) { TreeNode<Set<String>> hostNode = resultTree.getChild(hostType); if (hostNode == null) { hostNode = resultTree.addChild(new HashSet<>(), hostType); } hostComponentNode = hostNode.addChild(new HashSet<>(), hostComponentType); } resultTree.getChild(configType).getObject().add("properties"); hostComponentNode.getObject().add("HostRoles/component_name"); return resultTree; }