Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 933CA200C6A for ; Thu, 30 Mar 2017 00:40:27 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 91C5E160B95; Wed, 29 Mar 2017 22:40:27 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id BCB6B160BAE for ; Thu, 30 Mar 2017 00:40:24 +0200 (CEST) Received: (qmail 39056 invoked by uid 500); 29 Mar 2017 22:40:21 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 38280 invoked by uid 99); 29 Mar 2017 22:40:20 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Mar 2017 22:40:20 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 9D43DDFEE9; Wed, 29 Mar 2017 22:40:20 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ncole@apache.org To: commits@ambari.apache.org Date: Wed, 29 Mar 2017 22:40:57 -0000 Message-Id: <750aaa8c44ce4174ace7d8cbb6e7fce2@git.apache.org> In-Reply-To: <64b914f1d34c4628a2ec80942086fadd@git.apache.org> References: <64b914f1d34c4628a2ec80942086fadd@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [39/50] [abbrv] ambari git commit: AMBARI-19149. Code cleanup: redundant type arguments archived-at: Wed, 29 Mar 2017 22:40:27 -0000 http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java index 5204322..6687942 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java @@ -297,8 +297,8 @@ public class KerberosHelperImpl implements KerberosHelper { public void configureServices(Cluster cluster, Map> serviceFilter) throws AmbariException, KerberosInvalidConfigurationException { Map> existingConfigurations = calculateExistingConfigurations(cluster, null); - Map> installedServices = new HashMap>(); - Set previouslyExistingServices = new HashSet(); + Map> installedServices = new HashMap<>(); + Set previouslyExistingServices = new HashSet<>(); // Calculate the map of installed services to installed components Map clusterServices = cluster.getServices(); @@ -306,7 +306,7 @@ public class KerberosHelperImpl implements KerberosHelper { for (Service clusterService : clusterServices.values()) { Set installedComponents = installedServices.get(clusterService.getName()); if (installedComponents == null) { - installedComponents = new HashSet(); + installedComponents = new HashSet<>(); installedServices.put(clusterService.getName(), installedComponents); } @@ -351,7 +351,7 @@ public class KerberosHelperImpl implements KerberosHelper { boolean applyStackAdvisorUpdates) throws KerberosInvalidConfigurationException, AmbariException { - Map> kerberosConfigurations = new HashMap>(); + Map> kerberosConfigurations = new HashMap<>(); KerberosDetails kerberosDetails = getKerberosDetails(cluster, null); KerberosDescriptor kerberosDescriptor = getKerberosDescriptor(cluster); @@ -359,17 +359,17 @@ public class KerberosHelperImpl implements KerberosHelper { Map> configurations = addAdditionalConfigurations(cluster, deepCopy(existingConfigurations), null, kerberosDescriptorProperties); - Map> propertiesToIgnore = new HashMap>(); + Map> propertiesToIgnore = new HashMap<>(); // If Ambari is managing it own identities then add AMBARI to the set of installed servcie so // that its Kerberos descriptor entries will be included. if (createAmbariIdentities(existingConfigurations.get("kerberos-env"))) { - installedServices = new HashMap>(installedServices); + installedServices = new HashMap<>(installedServices); installedServices.put("AMBARI", Collections.singleton("AMBARI_SERVER")); } // Create the context to use for filtering Kerberos Identities based on the state of the cluster - Map filterContext = new HashMap(); + Map filterContext = new HashMap<>(); filterContext.put("configurations", configurations); filterContext.put("services", installedServices.keySet()); @@ -428,7 +428,7 @@ public class KerberosHelperImpl implements KerberosHelper { StackId stackVersion = cluster.getCurrentStackVersion(); - List hostNames = new ArrayList(); + List hostNames = new ArrayList<>(); Collection hosts = cluster.getHosts(); if (hosts != null) { @@ -442,10 +442,10 @@ public class KerberosHelperImpl implements KerberosHelper { // This could happen when enabling Kerberos while installing a cluster via Blueprints due to the // way hosts are discovered during the install process. if (!hostNames.isEmpty()) { - Map>> requestConfigurations = new HashMap>>(); + Map>> requestConfigurations = new HashMap<>(); if (existingConfigurations != null) { for (Map.Entry> configuration : existingConfigurations.entrySet()) { - Map> properties = new HashMap>(); + Map> properties = new HashMap<>(); String configType = configuration.getKey(); Map configurationProperties = configuration.getValue(); @@ -454,7 +454,7 @@ public class KerberosHelperImpl implements KerberosHelper { } if ("cluster-env".equals(configType)) { - configurationProperties = new HashMap(configurationProperties); + configurationProperties = new HashMap<>(configurationProperties); configurationProperties.put("security_enabled", (kerberosEnabled) ? "true" : "false"); } @@ -472,15 +472,15 @@ public class KerberosHelperImpl implements KerberosHelper { Map> requestConfiguration = requestConfigurations.get(configType); if (requestConfiguration == null) { - requestConfiguration = new HashMap>(); + requestConfiguration = new HashMap<>(); requestConfigurations.put(configType, requestConfiguration); } Map requestConfigurationProperties = requestConfiguration.get("properties"); if (requestConfigurationProperties == null) { - requestConfigurationProperties = new HashMap(); + requestConfigurationProperties = new HashMap<>(); } else { - requestConfigurationProperties = new HashMap(requestConfigurationProperties); + requestConfigurationProperties = new HashMap<>(requestConfigurationProperties); } requestConfigurationProperties.putAll(configurationProperties); @@ -490,7 +490,7 @@ public class KerberosHelperImpl implements KerberosHelper { StackAdvisorRequest request = StackAdvisorRequest.StackAdvisorRequestBuilder .forStack(stackVersion.getStackName(), stackVersion.getStackVersion()) - .forServices(new ArrayList(services)) + .forServices(new ArrayList<>(services)) .forHosts(hostNames) .withComponentHostsMap(cluster.getServiceComponentHostMap(null, services)) .withConfigurations(requestConfigurations) @@ -555,7 +555,7 @@ public class KerberosHelperImpl implements KerberosHelper { configType, propertyName, recommendedValue); if(kerberosConfigProperties == null) { - kerberosConfigProperties = new HashMap(); + kerberosConfigProperties = new HashMap<>(); kerberosConfigurations.put(configType, kerberosConfigProperties); } @@ -606,13 +606,13 @@ public class KerberosHelperImpl implements KerberosHelper { if (propertiesToRemove != null) { Set properties = propertiesToRemove.get(configType); if (properties == null) { - properties = new HashSet(); + properties = new HashSet<>(); propertiesToRemove.put(configType, properties); } properties.add(propertyName); } else { if (kerberosConfigProperties == null) { - kerberosConfigProperties = new HashMap(); + kerberosConfigProperties = new HashMap<>(); kerberosConfigurations.put(configType, kerberosConfigProperties); } kerberosConfigProperties.put(propertyName, ""); @@ -650,7 +650,7 @@ public class KerberosHelperImpl implements KerberosHelper { } // Create the context to use for filtering Kerberos Identities based on the state of the cluster - Map filterContext = new HashMap(); + Map filterContext = new HashMap<>(); filterContext.put("configurations", configurations); filterContext.put("services", services); @@ -869,7 +869,7 @@ public class KerberosHelperImpl implements KerberosHelper { if (kerberosDescriptor != null && processAuthToLocalRules) { Set authToLocalProperties; - Set authToLocalPropertiesToSet = new HashSet(); + Set authToLocalPropertiesToSet = new HashSet<>(); // a flag to be used by the AuthToLocalBuilder marking whether the default realm rule should contain the //L option, indicating username case insensitive behaviour // the 'kerberos-env' structure is expected to be available here as it was previously validated @@ -879,7 +879,7 @@ public class KerberosHelperImpl implements KerberosHelper { String additionalRealms = kerberosDescriptor.getProperty("additional_realms"); // Create the context to use for filtering Kerberos Identities based on the state of the cluster - Map filterContext = new HashMap(); + Map filterContext = new HashMap<>(); filterContext.put("configurations", existingConfigurations); filterContext.put("services", installedServices.keySet()); @@ -958,7 +958,7 @@ public class KerberosHelperImpl implements KerberosHelper { if (kerberosConfiguration != null) { builder.addRules(kerberosConfiguration.get(propertyName)); } else { - kerberosConfiguration = new HashMap(); + kerberosConfiguration = new HashMap<>(); kerberosConfigurations.put(configType, kerberosConfiguration); } @@ -978,7 +978,7 @@ public class KerberosHelperImpl implements KerberosHelper { Collection hostFilter, Collection identityFilter, Command shouldProcessCommand) throws AmbariException { - List serviceComponentHostsToProcess = new ArrayList(); + List serviceComponentHostsToProcess = new ArrayList<>(); Map services = cluster.getServices(); if ((services != null) && !services.isEmpty()) { @@ -1032,7 +1032,7 @@ public class KerberosHelperImpl implements KerberosHelper { @Override public Set getHostsWithValidKerberosClient(Cluster cluster) throws AmbariException { - Set hostsWithValidKerberosClient = new HashSet(); + Set hostsWithValidKerberosClient = new HashSet<>(); List schKerberosClients = cluster.getServiceComponentHosts(Service.Type.KERBEROS.name(), Role.KERBEROS_CLIENT.name()); if (schKerberosClients != null) { @@ -1079,7 +1079,7 @@ public class KerberosHelperImpl implements KerberosHelper { } if (evaluateWhenClauses) { - Set services = new HashSet(cluster.getServices().keySet()); + Set services = new HashSet<>(cluster.getServices().keySet()); if(additionalServices != null) { services.addAll(additionalServices); @@ -1087,7 +1087,7 @@ public class KerberosHelperImpl implements KerberosHelper { // Build the context needed to filter out Kerberos identities... // This includes the current set of configurations for the cluster and the set of installed services - Map context = new HashMap(); + Map context = new HashMap<>(); context.put("configurations", calculateConfigurations(cluster, null, kerberosDescriptor.getProperties())); context.put("services", services); @@ -1132,7 +1132,7 @@ public class KerberosHelperImpl implements KerberosHelper { if ((updates != null) && !updates.isEmpty()) { if (configurations == null) { - configurations = new HashMap>(); + configurations = new HashMap<>(); } for (Map.Entry entry : updates.entrySet()) { @@ -1249,7 +1249,7 @@ public class KerberosHelperImpl implements KerberosHelper { throw new AmbariException(String.format("The cluster object for the cluster name %s is not available", clusterName)); } - Map> activeIdentities = new HashMap>(); + Map> activeIdentities = new HashMap<>(); // Only calculate the active identities if the kerberos-env configurtaion is available. Else // important information like the realm will be missing (kerberos-env/realm) @@ -1296,12 +1296,12 @@ public class KerberosHelperImpl implements KerberosHelper { kerberosDescriptorProperties); // Create the context to use for filtering Kerberos Identities based on the state of the cluster - Map filterContext = new HashMap(); + Map filterContext = new HashMap<>(); filterContext.put("configurations", configurations); filterContext.put("services", existingServices); - Map hostActiveIdentities = new HashMap(); + Map hostActiveIdentities = new HashMap<>(); List identities = getActiveIdentities(cluster, hostname, serviceName, componentName, kerberosDescriptor, filterContext); @@ -1391,7 +1391,7 @@ public class KerberosHelperImpl implements KerberosHelper { @Override public List getAmbariServerIdentities(KerberosDescriptor kerberosDescriptor) throws AmbariException { - List ambariIdentities = new ArrayList(); + List ambariIdentities = new ArrayList<>(); KerberosServiceDescriptor ambariKerberosDescriptor = kerberosDescriptor.getService("AMBARI"); if (ambariKerberosDescriptor != null) { @@ -1779,7 +1779,7 @@ public class KerberosHelperImpl implements KerberosHelper { throw new AmbariException("The properties map must not be null. It is needed to store data related to the service check identity"); } - List serviceComponentHostsToProcess = new ArrayList(); + List serviceComponentHostsToProcess = new ArrayList<>(); KerberosDescriptor kerberosDescriptor = getKerberosDescriptor(cluster); KerberosIdentityDataFileWriter kerberosIdentityDataFileWriter = null; @@ -2092,7 +2092,7 @@ public class KerberosHelperImpl implements KerberosHelper { if (updates != null) { Map existingProperties = configurations.get(type); if (existingProperties == null) { - existingProperties = new HashMap(); + existingProperties = new HashMap<>(); configurations.put(type, existingProperties); } @@ -2247,8 +2247,8 @@ public class KerberosHelperImpl implements KerberosHelper { */ private List createUniqueHostList(Collection serviceComponentHosts, Set allowedStates) throws AmbariException { - Set hostNames = new HashSet(); - Set visitedHostNames = new HashSet(); + Set hostNames = new HashSet<>(); + Set visitedHostNames = new HashSet<>(); if (serviceComponentHosts != null) { for (ServiceComponentHost sch : serviceComponentHosts) { @@ -2271,7 +2271,7 @@ public class KerberosHelperImpl implements KerberosHelper { } } - return new ArrayList(hostNames); + return new ArrayList<>(hostNames); } @Override @@ -2309,7 +2309,7 @@ public class KerberosHelperImpl implements KerberosHelper { @Override public Map> getIdentityConfigurations(List identityDescriptors) { - Map> map = new HashMap>(); + Map> map = new HashMap<>(); if (identityDescriptors != null) { for (KerberosIdentityDescriptor identityDescriptor : identityDescriptors) { @@ -2346,7 +2346,7 @@ public class KerberosHelperImpl implements KerberosHelper { Map properties = map.get(type); if (properties == null) { - properties = new HashMap(); + properties = new HashMap<>(); map.put(type, properties); } @@ -2378,7 +2378,7 @@ public class KerberosHelperImpl implements KerberosHelper { Map filterContext) throws AmbariException { - List identities = new ArrayList(); + List identities = new ArrayList<>(); List serviceComponentHosts = cluster.getServiceComponentHosts(hostname); @@ -2426,7 +2426,7 @@ public class KerberosHelperImpl implements KerberosHelper { // Configurations from the tag is always expanded and then over-written by the actual // global:version1:{a1:A1,b1:B1,d1:D1} + global:{a1:A2,c1:C1,DELETED_d1:x} ==> // global:{a1:A2,b1:B1,c1:C1} - Map> configurations = new HashMap>(); + Map> configurations = new HashMap<>(); Map> configurationTags = ambariManagementController.findConfigurationTagsWithOverrides(cluster, hostname); Map> configProperties = configHelper.getEffectiveConfigProperties(cluster, configurationTags); @@ -2439,7 +2439,7 @@ public class KerberosHelperImpl implements KerberosHelper { Map configuration = configurations.get(type); if (configuration == null) { - configuration = new HashMap(allLevelMergedConfig); + configuration = new HashMap<>(allLevelMergedConfig); } else { Map mergedConfig = configHelper.getMergedConfig(allLevelMergedConfig, configuration); configuration.clear(); @@ -2472,7 +2472,7 @@ public class KerberosHelperImpl implements KerberosHelper { // and will also contain a value for the current host Map generalProperties = configurations.get(""); if (generalProperties == null) { - generalProperties = new HashMap(); + generalProperties = new HashMap<>(); configurations.put("", generalProperties); } @@ -2499,7 +2499,7 @@ public class KerberosHelperImpl implements KerberosHelper { Map> clusterHostInfo = StageUtils.getClusterHostInfo(cluster); if (clusterHostInfo != null) { - Map componentHosts = new HashMap(); + Map componentHosts = new HashMap<>(); clusterHostInfo = StageUtils.substituteHostIndexes(clusterHostInfo); @@ -2524,11 +2524,11 @@ public class KerberosHelperImpl implements KerberosHelper { if (map == null) { return null; } else { - Map> copy = new HashMap>(); + Map> copy = new HashMap<>(); for (Map.Entry> entry : map.entrySet()) { Map innerMap = entry.getValue(); - copy.put(entry.getKey(), (innerMap == null) ? null : new HashMap(innerMap)); + copy.put(entry.getKey(), (innerMap == null) ? null : new HashMap<>(innerMap)); } return copy; @@ -2543,7 +2543,7 @@ public class KerberosHelperImpl implements KerberosHelper { */ private KerberosDescriptor getKerberosDescriptorUpdates(Cluster cluster) throws AmbariException { // find instance using name and foreign keys - TreeMap foreignKeys = new TreeMap(); + TreeMap foreignKeys = new TreeMap<>(); foreignKeys.put("cluster", String.valueOf(cluster.getClusterId())); ArtifactEntity entity = artifactDAO.findByNameAndForeignKeys("kerberos_descriptor", foreignKeys); @@ -2596,7 +2596,7 @@ public class KerberosHelperImpl implements KerberosHelper { for (KerberosIdentityDescriptor identity : identities) { if (!identity.shouldInclude(context)) { if (set == null) { - set = new HashSet(); + set = new HashSet<>(); identitiesToRemove.put(currentPath, set); } @@ -2654,7 +2654,7 @@ public class KerberosHelperImpl implements KerberosHelper { if ((properties != null) && !properties.isEmpty()) { Set propertyNames = propertiesToIgnore.get(configType); if (propertyNames == null) { - propertyNames = new HashSet(); + propertyNames = new HashSet<>(); propertiesToIgnore.put(configType, propertyNames); } propertyNames.addAll(properties.keySet()); @@ -2938,12 +2938,12 @@ public class KerberosHelperImpl implements KerberosHelper { hostParamsJson); Collection filteredComponents = filterServiceComponentHostsForHosts( - new ArrayList(serviceComponentHosts), hostsWithValidKerberosClient); + new ArrayList<>(serviceComponentHosts), hostsWithValidKerberosClient); if (!filteredComponents.isEmpty()) { List hostsToUpdate = createUniqueHostList(filteredComponents, Collections.singleton(HostState.HEALTHY)); - Map requestParams = new HashMap(); - List requestResourceFilters = new ArrayList(); + Map requestParams = new HashMap<>(); + List requestResourceFilters = new ArrayList<>(); RequestResourceFilter reqResFilter = new RequestResourceFilter(Service.Type.KERBEROS.name(), Role.KERBEROS_CLIENT.name(), hostsToUpdate); requestResourceFilters.add(reqResFilter); @@ -3076,14 +3076,14 @@ public class KerberosHelperImpl implements KerberosHelper { hostParamsJson); Collection filteredComponents = filterServiceComponentHostsForHosts( - new ArrayList(serviceComponentHosts), hostsWithValidKerberosClient); + new ArrayList<>(serviceComponentHosts), hostsWithValidKerberosClient); if (!filteredComponents.isEmpty()) { List hostsToUpdate = createUniqueHostList(filteredComponents, Collections.singleton(HostState.HEALTHY)); if (!hostsToUpdate.isEmpty()) { - Map requestParams = new HashMap(); - List requestResourceFilters = new ArrayList(); + Map requestParams = new HashMap<>(); + List requestResourceFilters = new ArrayList<>(); RequestResourceFilter reqResFilter = new RequestResourceFilter("KERBEROS", "KERBEROS_CLIENT", hostsToUpdate); requestResourceFilters.add(reqResFilter); @@ -3133,7 +3133,7 @@ public class KerberosHelperImpl implements KerberosHelper { throws AmbariException { // Add the finalize stage... - Map commandParameters = new HashMap(); + Map commandParameters = new HashMap<>(); commandParameters.put(KerberosServerAction.DEFAULT_REALM, kerberosDetails.getDefaultRealm()); commandParameters.put(KerberosServerAction.KDC_TYPE, kerberosDetails.getKdcType().name()); commandParameters.put(KerberosServerAction.AUTHENTICATED_USER_NAME, ambariManagementController.getAuthName()); @@ -3245,7 +3245,7 @@ public class KerberosHelperImpl implements KerberosHelper { actionManager); } - Map commandParameters = new HashMap(); + Map commandParameters = new HashMap<>(); commandParameters.put(KerberosServerAction.AUTHENTICATED_USER_NAME, ambariManagementController.getAuthName()); commandParameters.put(KerberosServerAction.UPDATE_CONFIGURATION_NOTE, "Enabling Kerberos"); commandParameters.put(KerberosServerAction.UPDATE_CONFIGURATIONS, "true"); @@ -3363,7 +3363,7 @@ public class KerberosHelperImpl implements KerberosHelper { actionManager); } - Map commandParameters = new HashMap(); + Map commandParameters = new HashMap<>(); commandParameters.put(KerberosServerAction.AUTHENTICATED_USER_NAME, ambariManagementController.getAuthName()); commandParameters.put(KerberosServerAction.UPDATE_CONFIGURATION_NOTE, "Disabling Kerberos"); commandParameters.put(KerberosServerAction.UPDATE_CONFIGURATIONS, "true"); @@ -3517,7 +3517,7 @@ public class KerberosHelperImpl implements KerberosHelper { } - Map commandParameters = new HashMap(); + Map commandParameters = new HashMap<>(); commandParameters.put(KerberosServerAction.AUTHENTICATED_USER_NAME, ambariManagementController.getAuthName()); commandParameters.put(KerberosServerAction.DEFAULT_REALM, kerberosDetails.getDefaultRealm()); if (dataDirectory != null) { @@ -3640,7 +3640,7 @@ public class KerberosHelperImpl implements KerberosHelper { // 2) delete principals // 3) delete keytab files - Map commandParameters = new HashMap(); + Map commandParameters = new HashMap<>(); commandParameters.put(KerberosServerAction.AUTHENTICATED_USER_NAME, ambariManagementController.getAuthName()); commandParameters.put(KerberosServerAction.DEFAULT_REALM, kerberosDetails.getDefaultRealm()); if (dataDirectory != null) { http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/controller/LdapSyncRequest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/LdapSyncRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/LdapSyncRequest.java index 135b286..2ef52ba 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/LdapSyncRequest.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/LdapSyncRequest.java @@ -58,7 +58,7 @@ public class LdapSyncRequest { * @param type the request type */ public LdapSyncRequest(LdapSyncSpecEntity.SyncType type) { - this.principalNames = new HashSet(); + this.principalNames = new HashSet<>(); this.type = type; } http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/controller/MaintenanceStateHelper.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/MaintenanceStateHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/MaintenanceStateHelper.java index dd1652c..f72f476 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/MaintenanceStateHelper.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/MaintenanceStateHelper.java @@ -302,7 +302,7 @@ public class MaintenanceStateHelper { */ public Set> getMaintenanceHostComponents( Clusters clusters, Cluster cluster) throws AmbariException { - Set> set = new HashSet>(); + Set> set = new HashSet<>(); Map hosts = clusters.getHostsForCluster(cluster.getClusterName()); @@ -317,7 +317,7 @@ public class MaintenanceStateHelper { if (MaintenanceState.OFF != getEffectiveState(cluster.getClusterId(), service, host, sch)) { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("host", sch.getHostName()); map.put("service", sch.getServiceName()); map.put("component", sch.getServiceComponentName()); @@ -419,7 +419,7 @@ public class MaintenanceStateHelper { public Set filterHostsInMaintenanceState(Set candidateHosts, HostPredicate condition) throws AmbariException { // Filter hosts that are in MS - Set removedHosts = new HashSet(); + Set removedHosts = new HashSet<>(); for (String hostname : candidateHosts) { if (condition.shouldHostBeRemoved(hostname)) { removedHosts.add(hostname); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/controller/PrereqCheckRequest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/PrereqCheckRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/PrereqCheckRequest.java index 8584ef6..c8c9f9e 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/PrereqCheckRequest.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/PrereqCheckRequest.java @@ -39,7 +39,7 @@ public class PrereqCheckRequest { private UpgradeType m_upgradeType; private Map m_results = - new HashMap(); + new HashMap<>(); public PrereqCheckRequest(String clusterName, UpgradeType upgradeType) { http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/controller/RequestsByStatusesRequest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/RequestsByStatusesRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/RequestsByStatusesRequest.java index e86432d..0ed31a6 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/RequestsByStatusesRequest.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/RequestsByStatusesRequest.java @@ -27,7 +27,7 @@ public class RequestsByStatusesRequest { Set statuses; public RequestsByStatusesRequest() { - statuses = new HashSet(); + statuses = new HashSet<>(); statuses.add(HostRoleStatus.PENDING.toString()); statuses.add(HostRoleStatus.QUEUED.toString()); statuses.add(HostRoleStatus.IN_PROGRESS.toString()); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceResponseFactory.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceResponseFactory.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceResponseFactory.java index 11bc730..40fe369 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceResponseFactory.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/RootServiceResponseFactory.java @@ -72,7 +72,7 @@ public class RootServiceResponseFactory extends response = Collections.singleton(new RootServiceResponse(service.toString())); } else { - response = new HashSet(); + response = new HashSet<>(); for (Services service: Services.values()) response.add(new RootServiceResponse(service.toString())); @@ -83,7 +83,7 @@ public class RootServiceResponseFactory extends @Override public Set getRootServiceComponents( RootServiceComponentRequest request) throws ObjectNotFoundException { - Set response = new HashSet(); + Set response = new HashSet<>(); String serviceName = request.getServiceName(); String componentName = request.getComponentName(); @@ -196,7 +196,7 @@ public class RootServiceResponseFactory extends @Override public Set getRootServiceHostComponent(RootServiceHostComponentRequest request, Set hosts) throws AmbariException { - Set response = new HashSet(); + Set response = new HashSet<>(); Set rootServiceComponents = getRootServiceComponents(new RootServiceComponentRequest(request.getServiceName(), request.getComponentName())); @@ -204,7 +204,7 @@ public class RootServiceResponseFactory extends //Cartesian product with hosts and components for (RootServiceComponentResponse component : rootServiceComponents) { - Set filteredHosts = new HashSet(hosts); + Set filteredHosts = new HashSet<>(hosts); //Make some filtering of hosts if need if (component.getComponentName().equals(Components.AMBARI_SERVER.name())) http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceComponentResponse.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceComponentResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceComponentResponse.java index 2f42313..b48fad3 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceComponentResponse.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceComponentResponse.java @@ -137,7 +137,7 @@ public class StackServiceComponentResponse { if (null == definitions || definitions.size() == 0) { customCommands = Collections.emptyList(); } else { - customCommands = new ArrayList(definitions.size()); + customCommands = new ArrayList<>(definitions.size()); for (CustomCommandDefinition command : definitions) { customCommands.add(command.getName()); } http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceResponse.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceResponse.java index aaf5ed2..cbff300 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceResponse.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceResponse.java @@ -99,7 +99,7 @@ public class StackServiceResponse { if (null == definitions || definitions.size() == 0) { customCommands = Collections.emptyList(); } else { - customCommands = new ArrayList(definitions.size()); + customCommands = new ArrayList<>(definitions.size()); for (CustomCommandDefinition command : definitions) { customCommands.add(command.getName()); } http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/controller/StackVersionResponse.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackVersionResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackVersionResponse.java index 6463c50..3c65d05 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackVersionResponse.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackVersionResponse.java @@ -102,7 +102,7 @@ public class StackVersionResponse implements Validable{ this.valid = valid; } - private Set errorSet = new HashSet(); + private Set errorSet = new HashSet<>(); @Override public void addError(String error) { http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/controller/gsinstaller/ClusterDefinition.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/gsinstaller/ClusterDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/gsinstaller/ClusterDefinition.java index d183396..487ebff 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/gsinstaller/ClusterDefinition.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/gsinstaller/ClusterDefinition.java @@ -41,10 +41,10 @@ public class ClusterDefinition { private static final String DEFAULT_VERSION_ID = "HDP-1.2.0"; private static final String VERSION_ID_TAG = "VERSION="; - private final Set services = new HashSet(); - private final Set hosts = new HashSet(); - private final Map> components = new HashMap>(); - private final Map>> hostComponents = new HashMap>>(); + private final Set services = new HashSet<>(); + private final Set hosts = new HashSet<>(); + private final Map> components = new HashMap<>(); + private final Map>> hostComponents = new HashMap<>(); private final GSInstallerStateProvider stateProvider; private String clusterName; @@ -53,22 +53,22 @@ public class ClusterDefinition { /** * Index of host names to host component state. */ - private final Map> hostStateMap = new HashMap>(); + private final Map> hostStateMap = new HashMap<>(); /** * Index of service names to host component state. */ - private final Map> serviceStateMap = new HashMap>(); + private final Map> serviceStateMap = new HashMap<>(); /** * Index of component names to host component state. */ - private final Map> componentStateMap = new HashMap>(); + private final Map> componentStateMap = new HashMap<>(); /** * Index of host component names to host component state. */ - private final Map hostComponentStateMap = new HashMap(); + private final Map hostComponentStateMap = new HashMap<>(); /** * Expiry for the health value. @@ -79,7 +79,7 @@ public class ClusterDefinition { * Component name mapping to account for differences in what is provided by the gsInstaller * and what is expected by the Ambari providers. */ - private static final Map componentNameMap = new HashMap(); + private static final Map componentNameMap = new HashMap<>(); static { componentNameMap.put("GANGLIA", "GANGLIA_SERVER"); @@ -260,20 +260,20 @@ public class ClusterDefinition { services.add(serviceName); Set serviceComponents = components.get(serviceName); if (serviceComponents == null) { - serviceComponents = new HashSet(); + serviceComponents = new HashSet<>(); components.put(serviceName, serviceComponents); } serviceComponents.add(componentName); Map> serviceHostComponents = hostComponents.get(serviceName); if (serviceHostComponents == null) { - serviceHostComponents = new HashMap>(); + serviceHostComponents = new HashMap<>(); hostComponents.put(serviceName, serviceHostComponents); } Set hostHostComponents = serviceHostComponents.get(hostName); if (hostHostComponents == null) { - hostHostComponents = new HashSet(); + hostHostComponents = new HashSet<>(); serviceHostComponents.put(hostName, hostHostComponents); } hostHostComponents.add(componentName); @@ -328,7 +328,7 @@ public class ClusterDefinition { private static void addState(String hostName, Map> stateMap, HostComponentState state) { Set states = stateMap.get(hostName); if (states == null) { - states = new HashSet(); + states = new HashSet<>(); stateMap.put(hostName, states); } states.add(state); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerNoOpProvider.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerNoOpProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerNoOpProvider.java index 6c9bf8e..af7ab29 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerNoOpProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerNoOpProvider.java @@ -31,7 +31,7 @@ import org.apache.ambari.server.controller.spi.Resource; */ public class GSInstallerNoOpProvider extends GSInstallerResourceProvider{ - private final Map keyPropertyIds = new HashMap(); + private final Map keyPropertyIds = new HashMap<>(); // ----- GSInstallerResourceProvider --------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerProviderModule.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerProviderModule.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerProviderModule.java index 53efe8f..018ae19 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerProviderModule.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerProviderModule.java @@ -35,7 +35,7 @@ public class GSInstallerProviderModule extends AbstractProviderModule implements private final ClusterDefinition clusterDefinition; - private static final Map PORTS = new HashMap(); + private static final Map PORTS = new HashMap<>(); static { PORTS.put("NAMENODE", "50070"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerResourceProvider.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerResourceProvider.java index 4285f31..7b76cb9 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/gsinstaller/GSInstallerResourceProvider.java @@ -44,7 +44,7 @@ public abstract class GSInstallerResourceProvider implements ResourceProvider { private final ClusterDefinition clusterDefinition; - private final Set resources = new HashSet(); + private final Set resources = new HashSet<>(); private final Resource.Type type; @@ -63,7 +63,7 @@ public abstract class GSInstallerResourceProvider implements ResourceProvider { this.clusterDefinition = clusterDefinition; Set propertyIds = PropertyHelper.getPropertyIds(type); - this.propertyIds = new HashSet(propertyIds); + this.propertyIds = new HashSet<>(propertyIds); this.propertyIds.addAll(PropertyHelper.getCategories(propertyIds)); } @@ -80,7 +80,7 @@ public abstract class GSInstallerResourceProvider implements ResourceProvider { public Set getResources(Request request, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { - Set resultSet = new HashSet(); + Set resultSet = new HashSet<>(); for (Resource resource : resources) { if (predicate == null || predicate.evaluate(resource)) { @@ -111,7 +111,7 @@ public abstract class GSInstallerResourceProvider implements ResourceProvider { @Override public Set checkPropertyIds(Set propertyIds) { - propertyIds = new HashSet(propertyIds); + propertyIds = new HashSet<>(propertyIds); propertyIds.removeAll(this.propertyIds); return propertyIds; } @@ -165,10 +165,10 @@ public abstract class GSInstallerResourceProvider implements ResourceProvider { // if no properties are specified, then return them all if (propertyIds == null || propertyIds.isEmpty()) { - return new HashSet(this.propertyIds); + return new HashSet<>(this.propertyIds); } - propertyIds = new HashSet(propertyIds); + propertyIds = new HashSet<>(propertyIds); if (predicate != null) { propertyIds.addAll(PredicateHelper.getPropertyIds(predicate)); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractAuthorizedResourceProvider.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractAuthorizedResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractAuthorizedResourceProvider.java index 77279db..92a7256 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractAuthorizedResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractAuthorizedResourceProvider.java @@ -523,7 +523,7 @@ public abstract class AbstractAuthorizedResourceProvider extends AbstractResourc private Set createUnmodifiableSet(Set set) { return (set == null) ? Collections.emptySet() - : Collections.unmodifiableSet(new HashSet(set)); + : Collections.unmodifiableSet(new HashSet<>(set)); } } http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractPropertyProvider.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractPropertyProvider.java index 7cea24a..b6fca70 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractPropertyProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractPropertyProvider.java @@ -137,7 +137,7 @@ public abstract class AbstractPropertyProvider extends BaseProvider implements P * @return Cluster's Name */ protected Set getClustersNameFromResources(Set resources, String clusterNamePropertyId) { - Set clusNames = new HashSet(); + Set clusNames = new HashSet<>(); if (resources != null) { Iterator itr = resources.iterator(); while (itr.hasNext()) { @@ -158,7 +158,7 @@ public abstract class AbstractPropertyProvider extends BaseProvider implements P * @return cluster Id. */ protected Set getClustersResourceId(Set resources, String clusterNamePropertyId) { - Set clusterResId = new HashSet(); + Set clusterResId = new HashSet<>(); if (clusterNamePropertyId != null) { try { AmbariManagementController amc = AmbariServer.getController(); @@ -248,7 +248,7 @@ public abstract class AbstractPropertyProvider extends BaseProvider implements P * @return a map of metrics */ protected Map getPropertyInfoMap(String componentName, String propertyId) { - Map propertyInfoMap = new HashMap(); + Map propertyInfoMap = new HashMap<>(); updatePropertyInfoMap(componentName, propertyId, propertyInfoMap); @@ -346,8 +346,8 @@ public abstract class AbstractPropertyProvider extends BaseProvider implements P String methodName = argName.substring(matcher.start() + 1, openParenIndex); String args = argName.substring(openParenIndex + 1, closeParenIndex); - List argList = new LinkedList(); - List> paramTypes = new LinkedList>(); + List argList = new LinkedList<>(); + List> paramTypes = new LinkedList<>(); // for each argument of the method ... Matcher argMatcher = FIND_ARGUMENT_METHOD_ARGUMENTS_REGEX.matcher(args); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java index 55a772a..27ac03e 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java @@ -90,10 +90,10 @@ public abstract class AbstractProviderModule implements ProviderModule, private static final String GANGLIA_SERVER = "GANGLIA_SERVER"; private static final String METRIC_SERVER = "METRICS_COLLECTOR"; private static final String PROPERTIES_CATEGORY = "properties"; - private static final Map serviceConfigVersions = new ConcurrentHashMap(); - private static final Map serviceConfigTypes = new EnumMap(Service.Type.class); - private static final Map> serviceDesiredProperties = new EnumMap>(Service.Type.class); - private static final Map componentServiceMap = new HashMap(); + private static final Map serviceConfigVersions = new ConcurrentHashMap<>(); + private static final Map serviceConfigTypes = new EnumMap<>(Service.Type.class); + private static final Map> serviceDesiredProperties = new EnumMap<>(Service.Type.class); + private static final Map componentServiceMap = new HashMap<>(); private static final Map> HTTP_PROPERTY_REQUESTS = new HashMap<>(); @@ -102,10 +102,10 @@ public abstract class AbstractProviderModule implements ProviderModule, private static final String COLLECTOR_DEFAULT_PORT = "6188"; private static boolean vipHostConfigPresent = false; - private static final Map> jmxDesiredProperties = new HashMap>(); + private static final Map> jmxDesiredProperties = new HashMap<>(); private static final Map> jmxDesiredRpcSuffixProperties = new ConcurrentHashMap<>(); - private volatile Map>> jmxDesiredRpcSuffixes = new HashMap>>(); - private volatile Map clusterHdfsSiteConfigVersionMap = new HashMap(); + private volatile Map>> jmxDesiredRpcSuffixes = new HashMap<>(); + private volatile Map clusterHdfsSiteConfigVersionMap = new HashMap<>(); private volatile Map clusterJmxProtocolMap = new ConcurrentHashMap<>(); private volatile String clusterMetricServerPort = null; private volatile String clusterMetricServerVipPort = null; @@ -127,7 +127,7 @@ public abstract class AbstractProviderModule implements ProviderModule, componentServiceMap.put("NODEMANAGER", Service.Type.YARN); componentServiceMap.put("HISTORYSERVER", Service.Type.MAPREDUCE2); - Map initPropMap = new HashMap(); + Map initPropMap = new HashMap<>(); initPropMap.put("NAMENODE", new String[]{"dfs.http.address", "dfs.namenode.http-address"}); initPropMap.put("NAMENODE-HTTPS", new String[]{"dfs.namenode.https-address", "dfs.https.port"}); initPropMap.put("NAMENODE-HA", new String[]{"dfs.namenode.http-address.%s.%s"}); @@ -139,64 +139,64 @@ public abstract class AbstractProviderModule implements ProviderModule, serviceDesiredProperties.put(Service.Type.HDFS, initPropMap); - initPropMap = new HashMap(); + initPropMap = new HashMap<>(); initPropMap.put("HBASE_MASTER", new String[]{"hbase.master.info.port"}); initPropMap.put("HBASE_REGIONSERVER", new String[]{"hbase.regionserver.info.port"}); initPropMap.put("HBASE_MASTER-HTTPS", new String[]{"hbase.master.info.port"}); initPropMap.put("HBASE_REGIONSERVER-HTTPS", new String[]{"hbase.regionserver.info.port"}); serviceDesiredProperties.put(Service.Type.HBASE, initPropMap); - initPropMap = new HashMap(); + initPropMap = new HashMap<>(); initPropMap.put("RESOURCEMANAGER", new String[]{"yarn.resourcemanager.webapp.address"}); initPropMap.put("RESOURCEMANAGER-HTTPS", new String[]{"yarn.resourcemanager.webapp.https.address"}); initPropMap.put("NODEMANAGER", new String[]{"yarn.nodemanager.webapp.address"}); initPropMap.put("NODEMANAGER-HTTPS", new String[]{"yarn.nodemanager.webapp.https.address"}); serviceDesiredProperties.put(Service.Type.YARN, initPropMap); - initPropMap = new HashMap(); + initPropMap = new HashMap<>(); initPropMap.put("HISTORYSERVER", new String[]{"mapreduce.jobhistory.webapp.address"}); initPropMap.put("HISTORYSERVER-HTTPS", new String[]{"mapreduce.jobhistory.webapp.https.address"}); serviceDesiredProperties.put(Service.Type.MAPREDUCE2, initPropMap); - initPropMap = new HashMap(); + initPropMap = new HashMap<>(); initPropMap.put("NAMENODE", new String[]{"dfs.http.policy"}); jmxDesiredProperties.put("NAMENODE", initPropMap); - initPropMap = new HashMap(); + initPropMap = new HashMap<>(); initPropMap.put("DATANODE", new String[]{"dfs.http.policy"}); jmxDesiredProperties.put("DATANODE", initPropMap); - initPropMap = new HashMap(); + initPropMap = new HashMap<>(); initPropMap.put("JOURNALNODE", new String[]{"dfs.http.policy"}); jmxDesiredProperties.put("JOURNALNODE", initPropMap); - initPropMap = new HashMap(); + initPropMap = new HashMap<>(); initPropMap.put("RESOURCEMANAGER", new String[]{"yarn.http.policy"}); jmxDesiredProperties.put("RESOURCEMANAGER", initPropMap); - initPropMap = new HashMap(); + initPropMap = new HashMap<>(); initPropMap.put("HBASE_MASTER", new String[]{"hbase.ssl.enabled"}); jmxDesiredProperties.put("HBASE_MASTER", initPropMap); - initPropMap = new HashMap(); + initPropMap = new HashMap<>(); initPropMap.put("HBASE_REGIONSERVER", new String[]{"hbase.ssl.enabled"}); jmxDesiredProperties.put("HBASE_REGIONSERVER", initPropMap); - initPropMap = new HashMap(); + initPropMap = new HashMap<>(); initPropMap.put("NODEMANAGER", new String[]{"yarn.http.policy"}); jmxDesiredProperties.put("NODEMANAGER", initPropMap); - initPropMap = new HashMap(); + initPropMap = new HashMap<>(); initPropMap.put("HISTORYSERVER", new String[]{"mapreduce.jobhistory.http.policy"}); jmxDesiredProperties.put("HISTORYSERVER", initPropMap); - initPropMap = new HashMap(); + initPropMap = new HashMap<>(); initPropMap.put("client", new String[]{"dfs.namenode.rpc-address"}); initPropMap.put("datanode", new String[]{"dfs.namenode.servicerpc-address"}); initPropMap.put("healthcheck", new String[]{"dfs.namenode.lifeline.rpc-address"}); jmxDesiredRpcSuffixProperties.put("NAMENODE", initPropMap); - initPropMap = new HashMap(); + initPropMap = new HashMap<>(); initPropMap.put("client", new String[]{"dfs.namenode.rpc-address.%s.%s"}); initPropMap.put("datanode", new String[]{"dfs.namenode.servicerpc-address.%s.%s"}); initPropMap.put("healthcheck", new String[]{"dfs.namenode.lifeline.rpc-address.%s.%s"}); @@ -212,12 +212,12 @@ public abstract class AbstractProviderModule implements ProviderModule, /** * The map of resource providers. */ - private final Map resourceProviders = new HashMap(); + private final Map resourceProviders = new HashMap<>(); /** * The map of lists of property providers. */ - private final Map> propertyProviders = new HashMap>(); + private final Map> propertyProviders = new HashMap<>(); @Inject AmbariManagementController managementController; @@ -500,7 +500,7 @@ public abstract class AbstractProviderModule implements ProviderModule, synchronized (jmxPortMap) { clusterJmxPorts = jmxPortMap.get(clusterName); if (clusterJmxPorts == null) { - clusterJmxPorts = new ConcurrentHashMap>(); + clusterJmxPorts = new ConcurrentHashMap<>(); jmxPortMap.put(clusterName, clusterJmxPorts); } } @@ -528,7 +528,7 @@ public abstract class AbstractProviderModule implements ProviderModule, serviceConfigTypes.get(service) ); - Map componentPortsProperties = new HashMap(); + Map componentPortsProperties = new HashMap<>(); componentPortsProperties.put( componentName, getPortProperties(service, @@ -627,14 +627,14 @@ public abstract class AbstractProviderModule implements ProviderModule, private String postProcessPropertyValue(String key, String value, Map properties, Set prevProps) { if (value != null && key != null && value.contains("${")) { if (prevProps == null) { - prevProps = new HashSet(); + prevProps = new HashSet<>(); } if (prevProps.contains(key)) { return value; } prevProps.add(key); String refValueString = value; - Map refMap = new HashMap(); + Map refMap = new HashMap<>(); while (refValueString.contains("${")) { int startValueRef = refValueString.indexOf("${") + 2; int endValueRef = refValueString.indexOf('}'); @@ -678,7 +678,7 @@ public abstract class AbstractProviderModule implements ProviderModule, protected void createPropertyProviders(Resource.Type type) { - List providers = new LinkedList(); + List providers = new LinkedList<>(); ComponentSSLConfiguration configuration = ComponentSSLConfiguration.instance(); URLStreamProvider streamProvider = new URLStreamProvider( @@ -831,10 +831,10 @@ public abstract class AbstractProviderModule implements ProviderModule, private void initProviderMaps() throws SystemException { ResourceProvider provider = getResourceProvider(Resource.Type.Cluster); - Set propertyIds = new HashSet(); + Set propertyIds = new HashSet<>(); propertyIds.add(ClusterResourceProvider.CLUSTER_NAME_PROPERTY_ID); - Map requestInfoProperties = new HashMap(); + Map requestInfoProperties = new HashMap<>(); requestInfoProperties.put(ClusterResourceProvider.GET_IGNORE_PERMISSIONS_PROPERTY_ID, "true"); Request request = PropertyHelper.getReadRequest(propertyIds, @@ -844,8 +844,8 @@ public abstract class AbstractProviderModule implements ProviderModule, jmxPortMap.clear(); Set clusters = provider.getResources(request, null); - clusterHostComponentMap = new HashMap>(); - clusterGangliaCollectorMap = new HashMap(); + clusterHostComponentMap = new HashMap<>(); + clusterGangliaCollectorMap = new HashMap<>(); for (Resource cluster : clusters) { @@ -864,7 +864,7 @@ public abstract class AbstractProviderModule implements ProviderModule, Map hostComponentMap = clusterHostComponentMap.get(clusterName); if (hostComponentMap == null) { - hostComponentMap = new HashMap(); + hostComponentMap = new HashMap<>(); clusterHostComponentMap.put(clusterName, hostComponentMap); } @@ -980,7 +980,7 @@ public abstract class AbstractProviderModule implements ProviderModule, if(configProperties == null) { configProperties = getConfigProperties(clusterName, versionTag, configType); } - Map mConfigs = new HashMap(); + Map mConfigs = new HashMap<>(); if (!configProperties.isEmpty()) { Map evaluatedProperties = null; for (Entry entry : keys.entrySet()) { @@ -1004,7 +1004,7 @@ public abstract class AbstractProviderModule implements ProviderModule, if (value != null && value.contains("${")) { if (evaluatedProperties == null) { - evaluatedProperties = new HashMap(); + evaluatedProperties = new HashMap<>(); for (Map.Entry subentry : configProperties.entrySet()) { String keyString = subentry.getKey(); Object object = subentry.getValue(); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractResourceProvider.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractResourceProvider.java index 130370d..01cf79a 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractResourceProvider.java @@ -66,7 +66,7 @@ public abstract class AbstractResourceProvider extends BaseProvider implements R /** * Observers of this observable resource provider. */ - private final Set observers = new HashSet(); + private final Set observers = new HashSet<>(); protected final static Logger LOG = LoggerFactory.getLogger(AbstractResourceProvider.class); protected final static String PROPERTIES_ATTRIBUTES_REGEX = "properties_attributes/[a-zA-Z][a-zA-Z._-]*$"; @@ -168,7 +168,7 @@ public abstract class AbstractResourceProvider extends BaseProvider implements R PredicateHelper.visit(givenPredicate, visitor); List predicates = visitor.getSimplifiedPredicates(); - Set> propertyMaps = new HashSet>(); + Set> propertyMaps = new HashSet<>(); for (Predicate predicate : predicates) { propertyMaps.add(PredicateHelper.getProperties(predicate)); @@ -190,18 +190,18 @@ public abstract class AbstractResourceProvider extends BaseProvider implements R protected Set> getPropertyMaps(Map requestPropertyMap, Predicate givenPredicate) throws UnsupportedPropertyException, SystemException, NoSuchResourceException, NoSuchParentResourceException { - Set> propertyMaps = new HashSet>(); + Set> propertyMaps = new HashSet<>(); // If the predicate specifies a unique resource then we can simply return a single // property map for the update. Otherwise we need to do a get with the given predicate // to get the set of property maps for the resources that need to be updated. if (specifiesUniqueResource(givenPredicate)) { - Map propertyMap = new HashMap(PredicateHelper.getProperties(givenPredicate)); + Map propertyMap = new HashMap<>(PredicateHelper.getProperties(givenPredicate)); propertyMap.putAll(requestPropertyMap); propertyMaps.add(propertyMap); } else { for (Resource resource : getResources(givenPredicate)) { - Map propertyMap = new HashMap(PropertyHelper.getProperties(resource)); + Map propertyMap = new HashMap<>(PropertyHelper.getProperties(resource)); propertyMap.putAll(requestPropertyMap); propertyMaps.add(propertyMap); } @@ -364,7 +364,7 @@ public abstract class AbstractResourceProvider extends BaseProvider implements R */ public static List getConfigurationRequests(String parentCategory, Map properties) { - List configs = new LinkedList(); + List configs = new LinkedList<>(); String desiredConfigKey = parentCategory + "/desired_config"; // Multiple configs to be updated @@ -426,12 +426,12 @@ public abstract class AbstractResourceProvider extends BaseProvider implements R String attributeName = absCategory.substring(absCategory.lastIndexOf('/') + 1); Map> configAttributesMap = config.getPropertiesAttributes(); if (null == configAttributesMap) { - configAttributesMap = new HashMap>(); + configAttributesMap = new HashMap<>(); config.setPropertiesAttributes(configAttributesMap); } Map attributesMap = configAttributesMap.get(attributeName); if (null == attributesMap) { - attributesMap = new HashMap(); + attributesMap = new HashMap<>(); configAttributesMap.put(attributeName, attributesMap); } attributesMap.put(propName, propValue); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ActionResourceProvider.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ActionResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ActionResourceProvider.java index 47af083..f56b857 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ActionResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ActionResourceProvider.java @@ -62,8 +62,8 @@ public class ActionResourceProvider extends AbstractControllerResourceProvider { .getPropertyId("Actions", "target_type"); public static final String DEFAULT_TIMEOUT_PROPERTY_ID = PropertyHelper .getPropertyId("Actions", "default_timeout"); - private static Set pkPropertyIds = new HashSet( - Arrays.asList(new String[]{ACTION_NAME_PROPERTY_ID})); + private static Set pkPropertyIds = new HashSet<>( + Arrays.asList(new String[]{ACTION_NAME_PROPERTY_ID})); public ActionResourceProvider(Set propertyIds, Map keyPropertyIds, @@ -96,7 +96,7 @@ public class ActionResourceProvider extends AbstractControllerResourceProvider { throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { - final Set requests = new HashSet(); + final Set requests = new HashSet<>(); if (predicate != null) { for (Map propertyMap : getPropertyMaps(predicate)) { ActionRequest actionReq = getRequest(propertyMap); @@ -117,7 +117,7 @@ public class ActionResourceProvider extends AbstractControllerResourceProvider { }); Set requestedIds = getRequestPropertyIds(request, predicate); - Set resources = new HashSet(); + Set resources = new HashSet<>(); for (ActionResponse response : responses) { Resource resource = new ResourceImpl(Type.Action); @@ -178,7 +178,7 @@ public class ActionResourceProvider extends AbstractControllerResourceProvider { protected synchronized Set getActionDefinitions(Set requests) throws AmbariException { - Set responses = new HashSet(); + Set responses = new HashSet<>(); for (ActionRequest request : requests) { if (request.getActionName() == null) { List ads = getAmbariMetaInfo().getAllActionDefinition(); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ActiveWidgetLayoutResourceProvider.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ActiveWidgetLayoutResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ActiveWidgetLayoutResourceProvider.java index fe45e03..70a5723 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ActiveWidgetLayoutResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ActiveWidgetLayoutResourceProvider.java @@ -75,13 +75,13 @@ public class ActiveWidgetLayoutResourceProvider extends AbstractControllerResour public static final String ID = "id"; @SuppressWarnings("serial") - private static Set pkPropertyIds = new HashSet(); + private static Set pkPropertyIds = new HashSet<>(); @SuppressWarnings("serial") - public static Set propertyIds = new HashSet(); + public static Set propertyIds = new HashSet<>(); @SuppressWarnings("serial") - public static Map keyPropertyIds = new HashMap(); + public static Map keyPropertyIds = new HashMap<>(); static { pkPropertyIds.add(WIDGETLAYOUT_ID_PROPERTY_ID); @@ -141,11 +141,11 @@ public class ActiveWidgetLayoutResourceProvider extends AbstractControllerResour @Override public Set getResources(Request request, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { - final Set resources = new HashSet(); + final Set resources = new HashSet<>(); final Set requestedIds = getRequestPropertyIds(request, predicate); final Set> propertyMaps = getPropertyMaps(predicate); - List layoutEntities = new ArrayList(); + List layoutEntities = new ArrayList<>(); boolean isUserAdministrator = AuthorizationHelper.isAuthorized(ResourceType.AMBARI, null, RoleAuthorization.AMBARI_MANAGE_USERS); @@ -183,11 +183,11 @@ public class ActiveWidgetLayoutResourceProvider extends AbstractControllerResour resource.setProperty(WIDGETLAYOUT_USERNAME_PROPERTY_ID, layoutEntity.getUserName()); resource.setProperty(WIDGETLAYOUT_DISPLAY_NAME_PROPERTY_ID, layoutEntity.getDisplayName()); - List widgets = new ArrayList(); + List widgets = new ArrayList<>(); List widgetLayoutUserWidgetEntityList = layoutEntity.getListWidgetLayoutUserWidgetEntity(); for (WidgetLayoutUserWidgetEntity widgetLayoutUserWidgetEntity : widgetLayoutUserWidgetEntityList) { WidgetEntity widgetEntity = widgetLayoutUserWidgetEntity.getWidget(); - HashMap widgetInfoMap = new HashMap(); + HashMap widgetInfoMap = new HashMap<>(); widgetInfoMap.put("WidgetInfo",WidgetResponse.coerce(widgetEntity)); widgets.add(widgetInfoMap); } http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertDefinitionResourceProvider.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertDefinitionResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertDefinitionResourceProvider.java index 9c91c14..32f1fd8 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertDefinitionResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertDefinitionResourceProvider.java @@ -94,8 +94,8 @@ public class AlertDefinitionResourceProvider extends AbstractControllerResourceP protected static final String ALERT_DEF_SOURCE = "AlertDefinition/source"; protected static final String ALERT_DEF_SOURCE_TYPE = "AlertDefinition/source/type"; - private static Set pkPropertyIds = new HashSet( - Arrays.asList(ALERT_DEF_ID, ALERT_DEF_NAME)); + private static Set pkPropertyIds = new HashSet<>( + Arrays.asList(ALERT_DEF_ID, ALERT_DEF_NAME)); private static Gson gson = new Gson(); @@ -132,12 +132,12 @@ public class AlertDefinitionResourceProvider extends AbstractControllerResourceP /** * The property ids for an alert defintion resource. */ - private static final Set PROPERTY_IDS = new HashSet(); + private static final Set PROPERTY_IDS = new HashSet<>(); /** * The key property ids for an alert definition resource. */ - private static final Map KEY_PROPERTY_IDS = new HashMap(); + private static final Map KEY_PROPERTY_IDS = new HashMap<>(); static { // properties @@ -195,7 +195,7 @@ public class AlertDefinitionResourceProvider extends AbstractControllerResourceP private void createAlertDefinitions(Set> requestMaps) throws AmbariException, AuthorizationException { - List entities = new ArrayList(); + List entities = new ArrayList<>(); String clusterName = null; for (Map requestMap : requestMaps) { @@ -232,7 +232,7 @@ public class AlertDefinitionResourceProvider extends AbstractControllerResourceP Set requestPropertyIds = getRequestPropertyIds(request, predicate); // use a collection which preserves order since JPA sorts the results - Set results = new LinkedHashSet(); + Set results = new LinkedHashSet<>(); for (Map propertyMap : getPropertyMaps(predicate)) { String clusterName = (String) propertyMap.get(ALERT_DEF_CLUSTER_NAME); @@ -354,7 +354,7 @@ public class AlertDefinitionResourceProvider extends AbstractControllerResourceP Set resources = getResources( new RequestImpl(null, null, null, null), predicate); - Set definitionIds = new HashSet(); + Set definitionIds = new HashSet<>(); for (final Resource resource : resources) { Long id = (Long) resource.getPropertyValue(ALERT_DEF_ID); @@ -496,7 +496,7 @@ public class AlertDefinitionResourceProvider extends AbstractControllerResourceP // !!! The AlertDefinition "source" field is a nested JSON object; // build a JSON representation from the flat properties and then // serialize that JSON object as a string - Map jsonObjectMapping = new HashMap(); + Map jsonObjectMapping = new HashMap<>(); // for every property in the request, if it's a source property, then // add it to the JSON model http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertGroupResourceProvider.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertGroupResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertGroupResourceProvider.java index f5a5d7e..cf4e747 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertGroupResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertGroupResourceProvider.java @@ -69,18 +69,18 @@ public class AlertGroupResourceProvider extends public static final String ALERT_GROUP_DEFINITIONS = "AlertGroup/definitions"; public static final String ALERT_GROUP_TARGETS = "AlertGroup/targets"; - private static final Set PK_PROPERTY_IDS = new HashSet( - Arrays.asList(ALERT_GROUP_ID, ALERT_GROUP_CLUSTER_NAME)); + private static final Set PK_PROPERTY_IDS = new HashSet<>( + Arrays.asList(ALERT_GROUP_ID, ALERT_GROUP_CLUSTER_NAME)); /** * The property ids for an alert group resource. */ - private static final Set PROPERTY_IDS = new HashSet(); + private static final Set PROPERTY_IDS = new HashSet<>(); /** * The key property ids for an alert group resource. */ - private static final Map KEY_PROPERTY_IDS = new HashMap(); + private static final Map KEY_PROPERTY_IDS = new HashMap<>(); static { // properties @@ -140,7 +140,7 @@ public class AlertGroupResourceProvider extends throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { - Set results = new HashSet(); + Set results = new HashSet<>(); Set requestPropertyIds = getRequestPropertyIds(request, predicate); for (Map propertyMap : getPropertyMaps(predicate)) { @@ -213,7 +213,7 @@ public class AlertGroupResourceProvider extends Set resources = getResources(new RequestImpl(null, null, null, null), predicate); - Map entities = new HashMap(); + Map entities = new HashMap<>(); for (final Resource resource : resources) { Long id = (Long) resource.getPropertyValue(ALERT_GROUP_ID); @@ -268,7 +268,7 @@ public class AlertGroupResourceProvider extends private void createAlertGroups(Set> requestMaps) throws AmbariException, AuthorizationException { - List entities = new ArrayList(); + List entities = new ArrayList<>(); for (Map requestMap : requestMaps) { AlertGroupEntity entity = new AlertGroupEntity(); @@ -297,7 +297,7 @@ public class AlertGroupResourceProvider extends // targets are not required on creation if (requestMap.containsKey(ALERT_GROUP_TARGETS)) { List targetIds = (List) requestMap.get(ALERT_GROUP_TARGETS); - Set targets = new HashSet(); + Set targets = new HashSet<>(); targets.addAll(s_dao.findTargetsById(targetIds)); entity.setAlertTargets(targets); } @@ -305,7 +305,7 @@ public class AlertGroupResourceProvider extends // definitions are not required on creation if (requestMap.containsKey(ALERT_GROUP_DEFINITIONS)) { List definitionIds = (List) requestMap.get(ALERT_GROUP_DEFINITIONS); - Set definitions = new HashSet(); + Set definitions = new HashSet<>(); definitions.addAll(s_definitionDao.findByIds(definitionIds)); entity.setAlertDefinitions(definitions); } @@ -356,9 +356,9 @@ public class AlertGroupResourceProvider extends // if targets were supplied, replace existing if (null != targetIds) { - Set targets = new HashSet(); + Set targets = new HashSet<>(); - List ids = new ArrayList(targetIds.size()); + List ids = new ArrayList<>(targetIds.size()); ids.addAll(targetIds); if (ids.size() > 0) { @@ -377,9 +377,9 @@ public class AlertGroupResourceProvider extends } // if definitions were supplied, replace existing - Set definitions = new HashSet(); + Set definitions = new HashSet<>(); if (null != definitionIds && definitionIds.size() > 0) { - List ids = new ArrayList(definitionIds.size()); + List ids = new ArrayList<>(definitionIds.size()); ids.addAll(definitionIds); definitions.addAll(s_definitionDao.findByIds(ids)); @@ -417,8 +417,8 @@ public class AlertGroupResourceProvider extends // only set the definitions if requested if (BaseProvider.isPropertyRequested(ALERT_GROUP_DEFINITIONS, requestedIds)) { Set definitions = entity.getAlertDefinitions(); - List definitionList = new ArrayList( - definitions.size()); + List definitionList = new ArrayList<>( + definitions.size()); for (AlertDefinitionEntity definition : definitions) { AlertDefinitionResponse response = AlertDefinitionResponse.coerce(definition); @@ -431,8 +431,8 @@ public class AlertGroupResourceProvider extends if (BaseProvider.isPropertyRequested(ALERT_GROUP_TARGETS, requestedIds)) { Set targetEntities = entity.getAlertTargets(); - List targets = new ArrayList( - targetEntities.size()); + List targets = new ArrayList<>( + targetEntities.size()); for (AlertTargetEntity targetEntity : targetEntities) { AlertTarget target = AlertTarget.coerce(targetEntity); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertHistoryResourceProvider.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertHistoryResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertHistoryResourceProvider.java index 5792cb4..4b1892d 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertHistoryResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertHistoryResourceProvider.java @@ -69,8 +69,8 @@ public class AlertHistoryResourceProvider extends ReadOnlyResourceProvider imple public static final String ALERT_HISTORY_TIMESTAMP = "AlertHistory/timestamp"; public static final String ALERT_HISTORY_INSTANCE = "AlertHistory/instance"; - private static final Set PK_PROPERTY_IDS = new HashSet( - Arrays.asList(ALERT_HISTORY_ID)); + private static final Set PK_PROPERTY_IDS = new HashSet<>( + Arrays.asList(ALERT_HISTORY_ID)); /** * Used for querying alert history. @@ -84,13 +84,13 @@ public class AlertHistoryResourceProvider extends ReadOnlyResourceProvider imple /** * The property ids for an alert history resource. */ - private static final Set PROPERTY_IDS = new HashSet(); + private static final Set PROPERTY_IDS = new HashSet<>(); /** * The key property ids for an alert history resource. */ private static final Map KEY_PROPERTY_IDS = - new HashMap(); + new HashMap<>(); static { // properties @@ -199,7 +199,7 @@ public class AlertHistoryResourceProvider extends ReadOnlyResourceProvider imple } } - Set results = new LinkedHashSet(); + Set results = new LinkedHashSet<>(); Set requestPropertyIds = getRequestPropertyIds(request, predicate); AlertHistoryRequest historyRequest = new AlertHistoryRequest();