You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2017/03/31 07:22:35 UTC
[28/55] [abbrv] ambari git commit: AMBARI-19149. Code cleanup:
redundant type arguments
http://git-wip-us.apache.org/repos/asf/ambari/blob/e8080350/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<String, Collection<String>> serviceFilter)
throws AmbariException, KerberosInvalidConfigurationException {
Map<String, Map<String, String>> existingConfigurations = calculateExistingConfigurations(cluster, null);
- Map<String, Set<String>> installedServices = new HashMap<String, Set<String>>();
- Set<String> previouslyExistingServices = new HashSet<String>();
+ Map<String, Set<String>> installedServices = new HashMap<>();
+ Set<String> previouslyExistingServices = new HashSet<>();
// Calculate the map of installed services to installed components
Map<String, Service> clusterServices = cluster.getServices();
@@ -306,7 +306,7 @@ public class KerberosHelperImpl implements KerberosHelper {
for (Service clusterService : clusterServices.values()) {
Set<String> installedComponents = installedServices.get(clusterService.getName());
if (installedComponents == null) {
- installedComponents = new HashSet<String>();
+ installedComponents = new HashSet<>();
installedServices.put(clusterService.getName(), installedComponents);
}
@@ -351,7 +351,7 @@ public class KerberosHelperImpl implements KerberosHelper {
boolean applyStackAdvisorUpdates)
throws KerberosInvalidConfigurationException, AmbariException {
- Map<String, Map<String, String>> kerberosConfigurations = new HashMap<String, Map<String, String>>();
+ Map<String, Map<String, String>> kerberosConfigurations = new HashMap<>();
KerberosDetails kerberosDetails = getKerberosDetails(cluster, null);
KerberosDescriptor kerberosDescriptor = getKerberosDescriptor(cluster);
@@ -359,17 +359,17 @@ public class KerberosHelperImpl implements KerberosHelper {
Map<String, Map<String, String>> configurations = addAdditionalConfigurations(cluster,
deepCopy(existingConfigurations), null, kerberosDescriptorProperties);
- Map<String, Set<String>> propertiesToIgnore = new HashMap<String, Set<String>>();
+ Map<String, Set<String>> 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<String, Set<String>>(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<String, Object> filterContext = new HashMap<String, Object>();
+ Map<String, Object> 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<String> hostNames = new ArrayList<String>();
+ List<String> hostNames = new ArrayList<>();
Collection<Host> 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<String, Map<String, Map<String, String>>> requestConfigurations = new HashMap<String, Map<String, Map<String, String>>>();
+ Map<String, Map<String, Map<String, String>>> requestConfigurations = new HashMap<>();
if (existingConfigurations != null) {
for (Map.Entry<String, Map<String, String>> configuration : existingConfigurations.entrySet()) {
- Map<String, Map<String, String>> properties = new HashMap<String, Map<String, String>>();
+ Map<String, Map<String, String>> properties = new HashMap<>();
String configType = configuration.getKey();
Map<String, String> configurationProperties = configuration.getValue();
@@ -454,7 +454,7 @@ public class KerberosHelperImpl implements KerberosHelper {
}
if ("cluster-env".equals(configType)) {
- configurationProperties = new HashMap<String, String>(configurationProperties);
+ configurationProperties = new HashMap<>(configurationProperties);
configurationProperties.put("security_enabled", (kerberosEnabled) ? "true" : "false");
}
@@ -472,15 +472,15 @@ public class KerberosHelperImpl implements KerberosHelper {
Map<String, Map<String, String>> requestConfiguration = requestConfigurations.get(configType);
if (requestConfiguration == null) {
- requestConfiguration = new HashMap<String, Map<String, String>>();
+ requestConfiguration = new HashMap<>();
requestConfigurations.put(configType, requestConfiguration);
}
Map<String, String> requestConfigurationProperties = requestConfiguration.get("properties");
if (requestConfigurationProperties == null) {
- requestConfigurationProperties = new HashMap<String, String>();
+ requestConfigurationProperties = new HashMap<>();
} else {
- requestConfigurationProperties = new HashMap<String, String>(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<String>(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<String, String>();
+ kerberosConfigProperties = new HashMap<>();
kerberosConfigurations.put(configType, kerberosConfigProperties);
}
@@ -606,13 +606,13 @@ public class KerberosHelperImpl implements KerberosHelper {
if (propertiesToRemove != null) {
Set<String> properties = propertiesToRemove.get(configType);
if (properties == null) {
- properties = new HashSet<String>();
+ properties = new HashSet<>();
propertiesToRemove.put(configType, properties);
}
properties.add(propertyName);
} else {
if (kerberosConfigProperties == null) {
- kerberosConfigProperties = new HashMap<String, String>();
+ 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<String, Object> filterContext = new HashMap<String, Object>();
+ Map<String, Object> 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<String> authToLocalProperties;
- Set<String> authToLocalPropertiesToSet = new HashSet<String>();
+ Set<String> 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<String, Object> filterContext = new HashMap<String, Object>();
+ Map<String, Object> 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<String, String>();
+ kerberosConfiguration = new HashMap<>();
kerberosConfigurations.put(configType, kerberosConfiguration);
}
@@ -978,7 +978,7 @@ public class KerberosHelperImpl implements KerberosHelper {
Collection<String> hostFilter, Collection<String> identityFilter,
Command<Boolean, ServiceComponentHost> shouldProcessCommand)
throws AmbariException {
- List<ServiceComponentHost> serviceComponentHostsToProcess = new ArrayList<ServiceComponentHost>();
+ List<ServiceComponentHost> serviceComponentHostsToProcess = new ArrayList<>();
Map<String, Service> services = cluster.getServices();
if ((services != null) && !services.isEmpty()) {
@@ -1032,7 +1032,7 @@ public class KerberosHelperImpl implements KerberosHelper {
@Override
public Set<String> getHostsWithValidKerberosClient(Cluster cluster)
throws AmbariException {
- Set<String> hostsWithValidKerberosClient = new HashSet<String>();
+ Set<String> hostsWithValidKerberosClient = new HashSet<>();
List<ServiceComponentHost> 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<String> services = new HashSet<String>(cluster.getServices().keySet());
+ Set<String> 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<String, Object> context = new HashMap<String, Object>();
+ Map<String, Object> 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<String, Map<String, String>>();
+ configurations = new HashMap<>();
}
for (Map.Entry<String, KerberosConfigurationDescriptor> 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<String, Collection<KerberosIdentityDescriptor>> activeIdentities = new HashMap<String, Collection<KerberosIdentityDescriptor>>();
+ Map<String, Collection<KerberosIdentityDescriptor>> 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<String, Object> filterContext = new HashMap<String, Object>();
+ Map<String, Object> filterContext = new HashMap<>();
filterContext.put("configurations", configurations);
filterContext.put("services", existingServices);
- Map<String, KerberosIdentityDescriptor> hostActiveIdentities = new HashMap<String, KerberosIdentityDescriptor>();
+ Map<String, KerberosIdentityDescriptor> hostActiveIdentities = new HashMap<>();
List<KerberosIdentityDescriptor> identities = getActiveIdentities(cluster, hostname,
serviceName, componentName, kerberosDescriptor, filterContext);
@@ -1391,7 +1391,7 @@ public class KerberosHelperImpl implements KerberosHelper {
@Override
public List<KerberosIdentityDescriptor> getAmbariServerIdentities(KerberosDescriptor kerberosDescriptor) throws AmbariException {
- List<KerberosIdentityDescriptor> ambariIdentities = new ArrayList<KerberosIdentityDescriptor>();
+ List<KerberosIdentityDescriptor> 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<ServiceComponentHost> serviceComponentHostsToProcess = new ArrayList<ServiceComponentHost>();
+ List<ServiceComponentHost> serviceComponentHostsToProcess = new ArrayList<>();
KerberosDescriptor kerberosDescriptor = getKerberosDescriptor(cluster);
KerberosIdentityDataFileWriter kerberosIdentityDataFileWriter = null;
@@ -2092,7 +2092,7 @@ public class KerberosHelperImpl implements KerberosHelper {
if (updates != null) {
Map<String, String> existingProperties = configurations.get(type);
if (existingProperties == null) {
- existingProperties = new HashMap<String, String>();
+ existingProperties = new HashMap<>();
configurations.put(type, existingProperties);
}
@@ -2247,8 +2247,8 @@ public class KerberosHelperImpl implements KerberosHelper {
*/
private List<String> createUniqueHostList(Collection<ServiceComponentHost> serviceComponentHosts, Set<HostState> allowedStates)
throws AmbariException {
- Set<String> hostNames = new HashSet<String>();
- Set<String> visitedHostNames = new HashSet<String>();
+ Set<String> hostNames = new HashSet<>();
+ Set<String> visitedHostNames = new HashSet<>();
if (serviceComponentHosts != null) {
for (ServiceComponentHost sch : serviceComponentHosts) {
@@ -2271,7 +2271,7 @@ public class KerberosHelperImpl implements KerberosHelper {
}
}
- return new ArrayList<String>(hostNames);
+ return new ArrayList<>(hostNames);
}
@Override
@@ -2309,7 +2309,7 @@ public class KerberosHelperImpl implements KerberosHelper {
@Override
public Map<String, Map<String, String>> getIdentityConfigurations(List<KerberosIdentityDescriptor> identityDescriptors) {
- Map<String, Map<String, String>> map = new HashMap<String, Map<String, String>>();
+ Map<String, Map<String, String>> map = new HashMap<>();
if (identityDescriptors != null) {
for (KerberosIdentityDescriptor identityDescriptor : identityDescriptors) {
@@ -2346,7 +2346,7 @@ public class KerberosHelperImpl implements KerberosHelper {
Map<String, String> properties = map.get(type);
if (properties == null) {
- properties = new HashMap<String, String>();
+ properties = new HashMap<>();
map.put(type, properties);
}
@@ -2378,7 +2378,7 @@ public class KerberosHelperImpl implements KerberosHelper {
Map<String, Object> filterContext)
throws AmbariException {
- List<KerberosIdentityDescriptor> identities = new ArrayList<KerberosIdentityDescriptor>();
+ List<KerberosIdentityDescriptor> identities = new ArrayList<>();
List<ServiceComponentHost> 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<String, Map<String, String>> configurations = new HashMap<String, Map<String, String>>();
+ Map<String, Map<String, String>> configurations = new HashMap<>();
Map<String, Map<String, String>> configurationTags = ambariManagementController.findConfigurationTagsWithOverrides(cluster, hostname);
Map<String, Map<String, String>> configProperties = configHelper.getEffectiveConfigProperties(cluster, configurationTags);
@@ -2439,7 +2439,7 @@ public class KerberosHelperImpl implements KerberosHelper {
Map<String, String> configuration = configurations.get(type);
if (configuration == null) {
- configuration = new HashMap<String, String>(allLevelMergedConfig);
+ configuration = new HashMap<>(allLevelMergedConfig);
} else {
Map<String, String> 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<String, String> generalProperties = configurations.get("");
if (generalProperties == null) {
- generalProperties = new HashMap<String, String>();
+ generalProperties = new HashMap<>();
configurations.put("", generalProperties);
}
@@ -2499,7 +2499,7 @@ public class KerberosHelperImpl implements KerberosHelper {
Map<String, Set<String>> clusterHostInfo = StageUtils.getClusterHostInfo(cluster);
if (clusterHostInfo != null) {
- Map<String, String> componentHosts = new HashMap<String, String>();
+ Map<String, String> componentHosts = new HashMap<>();
clusterHostInfo = StageUtils.substituteHostIndexes(clusterHostInfo);
@@ -2524,11 +2524,11 @@ public class KerberosHelperImpl implements KerberosHelper {
if (map == null) {
return null;
} else {
- Map<String, Map<String, String>> copy = new HashMap<String, Map<String, String>>();
+ Map<String, Map<String, String>> copy = new HashMap<>();
for (Map.Entry<String, Map<String, String>> entry : map.entrySet()) {
Map<String, String> innerMap = entry.getValue();
- copy.put(entry.getKey(), (innerMap == null) ? null : new HashMap<String, String>(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<String, String> foreignKeys = new TreeMap<String, String>();
+ TreeMap<String, String> 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<String>();
+ set = new HashSet<>();
identitiesToRemove.put(currentPath, set);
}
@@ -2654,7 +2654,7 @@ public class KerberosHelperImpl implements KerberosHelper {
if ((properties != null) && !properties.isEmpty()) {
Set<String> propertyNames = propertiesToIgnore.get(configType);
if (propertyNames == null) {
- propertyNames = new HashSet<String>();
+ propertyNames = new HashSet<>();
propertiesToIgnore.put(configType, propertyNames);
}
propertyNames.addAll(properties.keySet());
@@ -2938,12 +2938,12 @@ public class KerberosHelperImpl implements KerberosHelper {
hostParamsJson);
Collection<ServiceComponentHost> filteredComponents = filterServiceComponentHostsForHosts(
- new ArrayList<ServiceComponentHost>(serviceComponentHosts), hostsWithValidKerberosClient);
+ new ArrayList<>(serviceComponentHosts), hostsWithValidKerberosClient);
if (!filteredComponents.isEmpty()) {
List<String> hostsToUpdate = createUniqueHostList(filteredComponents, Collections.singleton(HostState.HEALTHY));
- Map<String, String> requestParams = new HashMap<String, String>();
- List<RequestResourceFilter> requestResourceFilters = new ArrayList<RequestResourceFilter>();
+ Map<String, String> requestParams = new HashMap<>();
+ List<RequestResourceFilter> 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<ServiceComponentHost> filteredComponents = filterServiceComponentHostsForHosts(
- new ArrayList<ServiceComponentHost>(serviceComponentHosts), hostsWithValidKerberosClient);
+ new ArrayList<>(serviceComponentHosts), hostsWithValidKerberosClient);
if (!filteredComponents.isEmpty()) {
List<String> hostsToUpdate = createUniqueHostList(filteredComponents, Collections.singleton(HostState.HEALTHY));
if (!hostsToUpdate.isEmpty()) {
- Map<String, String> requestParams = new HashMap<String, String>();
- List<RequestResourceFilter> requestResourceFilters = new ArrayList<RequestResourceFilter>();
+ Map<String, String> requestParams = new HashMap<>();
+ List<RequestResourceFilter> 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<String, String> commandParameters = new HashMap<String, String>();
+ Map<String, String> 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<String, String> commandParameters = new HashMap<String, String>();
+ Map<String, String> 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<String, String> commandParameters = new HashMap<String, String>();
+ Map<String, String> 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<String, String> commandParameters = new HashMap<String, String>();
+ Map<String, String> 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<String, String> commandParameters = new HashMap<String, String>();
+ Map<String, String> 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/e8080350/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<String>();
+ this.principalNames = new HashSet<>();
this.type = type;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/e8080350/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<Map<String, String>> getMaintenanceHostComponents(
Clusters clusters, Cluster cluster) throws AmbariException {
- Set<Map<String, String>> set = new HashSet<Map<String, String>>();
+ Set<Map<String, String>> set = new HashSet<>();
Map<String, Host> hosts = clusters.getHostsForCluster(cluster.getClusterName());
@@ -317,7 +317,7 @@ public class MaintenanceStateHelper {
if (MaintenanceState.OFF != getEffectiveState(cluster.getClusterId(),
service, host, sch)) {
- Map<String, String> map = new HashMap<String, String>();
+ Map<String, String> 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<String> filterHostsInMaintenanceState(Set<String> candidateHosts,
HostPredicate condition) throws AmbariException {
// Filter hosts that are in MS
- Set<String> removedHosts = new HashSet<String>();
+ Set<String> removedHosts = new HashSet<>();
for (String hostname : candidateHosts) {
if (condition.shouldHostBeRemoved(hostname)) {
removedHosts.add(hostname);
http://git-wip-us.apache.org/repos/asf/ambari/blob/e8080350/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<CheckDescription, PrereqCheckStatus> m_results =
- new HashMap<CheckDescription, PrereqCheckStatus>();
+ new HashMap<>();
public PrereqCheckRequest(String clusterName, UpgradeType upgradeType) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/e8080350/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<String> statuses;
public RequestsByStatusesRequest() {
- statuses = new HashSet<String>();
+ 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/e8080350/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<RootServiceResponse>();
+ 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<RootServiceComponentResponse> getRootServiceComponents(
RootServiceComponentRequest request) throws ObjectNotFoundException {
- Set<RootServiceComponentResponse> response = new HashSet<RootServiceComponentResponse>();
+ Set<RootServiceComponentResponse> response = new HashSet<>();
String serviceName = request.getServiceName();
String componentName = request.getComponentName();
@@ -196,7 +196,7 @@ public class RootServiceResponseFactory extends
@Override
public Set<RootServiceHostComponentResponse> getRootServiceHostComponent(RootServiceHostComponentRequest request, Set<HostResponse> hosts) throws AmbariException {
- Set<RootServiceHostComponentResponse> response = new HashSet<RootServiceHostComponentResponse>();
+ Set<RootServiceHostComponentResponse> response = new HashSet<>();
Set<RootServiceComponentResponse> 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<HostResponse> filteredHosts = new HashSet<HostResponse>(hosts);
+ Set<HostResponse> 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/e8080350/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<String>(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/e8080350/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<String>(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/e8080350/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<String> errorSet = new HashSet<String>();
+ private Set<String> errorSet = new HashSet<>();
@Override
public void addError(String error) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/e8080350/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<String> services = new HashSet<String>();
- private final Set<String> hosts = new HashSet<String>();
- private final Map<String, Set<String>> components = new HashMap<String, Set<String>>();
- private final Map<String, Map<String, Set<String>>> hostComponents = new HashMap<String, Map<String, Set<String>>>();
+ private final Set<String> services = new HashSet<>();
+ private final Set<String> hosts = new HashSet<>();
+ private final Map<String, Set<String>> components = new HashMap<>();
+ private final Map<String, Map<String, Set<String>>> 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<String, Set<HostComponentState>> hostStateMap = new HashMap<String, Set<HostComponentState>>();
+ private final Map<String, Set<HostComponentState>> hostStateMap = new HashMap<>();
/**
* Index of service names to host component state.
*/
- private final Map<String, Set<HostComponentState>> serviceStateMap = new HashMap<String, Set<HostComponentState>>();
+ private final Map<String, Set<HostComponentState>> serviceStateMap = new HashMap<>();
/**
* Index of component names to host component state.
*/
- private final Map<String, Set<HostComponentState>> componentStateMap = new HashMap<String, Set<HostComponentState>>();
+ private final Map<String, Set<HostComponentState>> componentStateMap = new HashMap<>();
/**
* Index of host component names to host component state.
*/
- private final Map<String, HostComponentState> hostComponentStateMap = new HashMap<String, HostComponentState>();
+ private final Map<String, HostComponentState> 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<String, String> componentNameMap = new HashMap<String, String>();
+ private static final Map<String, String> componentNameMap = new HashMap<>();
static {
componentNameMap.put("GANGLIA", "GANGLIA_SERVER");
@@ -260,20 +260,20 @@ public class ClusterDefinition {
services.add(serviceName);
Set<String> serviceComponents = components.get(serviceName);
if (serviceComponents == null) {
- serviceComponents = new HashSet<String>();
+ serviceComponents = new HashSet<>();
components.put(serviceName, serviceComponents);
}
serviceComponents.add(componentName);
Map<String, Set<String>> serviceHostComponents = hostComponents.get(serviceName);
if (serviceHostComponents == null) {
- serviceHostComponents = new HashMap<String, Set<String>>();
+ serviceHostComponents = new HashMap<>();
hostComponents.put(serviceName, serviceHostComponents);
}
Set<String> hostHostComponents = serviceHostComponents.get(hostName);
if (hostHostComponents == null) {
- hostHostComponents = new HashSet<String>();
+ hostHostComponents = new HashSet<>();
serviceHostComponents.put(hostName, hostHostComponents);
}
hostHostComponents.add(componentName);
@@ -328,7 +328,7 @@ public class ClusterDefinition {
private static void addState(String hostName, Map<String, Set<HostComponentState>> stateMap, HostComponentState state) {
Set<HostComponentState> states = stateMap.get(hostName);
if (states == null) {
- states = new HashSet<HostComponentState>();
+ states = new HashSet<>();
stateMap.put(hostName, states);
}
states.add(state);
http://git-wip-us.apache.org/repos/asf/ambari/blob/e8080350/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<Resource.Type, String> keyPropertyIds = new HashMap<Resource.Type, String>();
+ private final Map<Resource.Type, String> keyPropertyIds = new HashMap<>();
// ----- GSInstallerResourceProvider ---------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/e8080350/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<String, String> PORTS = new HashMap<String, String>();
+ private static final Map<String, String> PORTS = new HashMap<>();
static {
PORTS.put("NAMENODE", "50070");
http://git-wip-us.apache.org/repos/asf/ambari/blob/e8080350/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<Resource> resources = new HashSet<Resource>();
+ private final Set<Resource> resources = new HashSet<>();
private final Resource.Type type;
@@ -63,7 +63,7 @@ public abstract class GSInstallerResourceProvider implements ResourceProvider {
this.clusterDefinition = clusterDefinition;
Set<String> propertyIds = PropertyHelper.getPropertyIds(type);
- this.propertyIds = new HashSet<String>(propertyIds);
+ this.propertyIds = new HashSet<>(propertyIds);
this.propertyIds.addAll(PropertyHelper.getCategories(propertyIds));
}
@@ -80,7 +80,7 @@ public abstract class GSInstallerResourceProvider implements ResourceProvider {
public Set<Resource> getResources(Request request, Predicate predicate)
throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
- Set<Resource> resultSet = new HashSet<Resource>();
+ Set<Resource> 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<String> checkPropertyIds(Set<String> propertyIds) {
- propertyIds = new HashSet<String>(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<String>(this.propertyIds);
+ return new HashSet<>(this.propertyIds);
}
- propertyIds = new HashSet<String>(propertyIds);
+ propertyIds = new HashSet<>(propertyIds);
if (predicate != null) {
propertyIds.addAll(PredicateHelper.getPropertyIds(predicate));
http://git-wip-us.apache.org/repos/asf/ambari/blob/e8080350/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<RoleAuthorization> createUnmodifiableSet(Set<RoleAuthorization> set) {
return (set == null)
? Collections.<RoleAuthorization>emptySet()
- : Collections.unmodifiableSet(new HashSet<RoleAuthorization>(set));
+ : Collections.unmodifiableSet(new HashSet<>(set));
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/e8080350/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<String> getClustersNameFromResources(Set<Resource> resources, String clusterNamePropertyId) {
- Set<String> clusNames = new HashSet<String>();
+ Set<String> clusNames = new HashSet<>();
if (resources != null) {
Iterator<Resource> itr = resources.iterator();
while (itr.hasNext()) {
@@ -158,7 +158,7 @@ public abstract class AbstractPropertyProvider extends BaseProvider implements P
* @return cluster Id.
*/
protected Set<Long> getClustersResourceId(Set<Resource> resources, String clusterNamePropertyId) {
- Set<Long> clusterResId = new HashSet<Long>();
+ Set<Long> 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<String, PropertyInfo> getPropertyInfoMap(String componentName, String propertyId) {
- Map<String, PropertyInfo> propertyInfoMap = new HashMap<String, PropertyInfo>();
+ Map<String, PropertyInfo> 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<Object> argList = new LinkedList<Object>();
- List<Class<?>> paramTypes = new LinkedList<Class<?>>();
+ List<Object> argList = new LinkedList<>();
+ List<Class<?>> 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/e8080350/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<String, String> serviceConfigVersions = new ConcurrentHashMap<String, String>();
- private static final Map<Service.Type, String> serviceConfigTypes = new EnumMap<Service.Type, String>(Service.Type.class);
- private static final Map<Service.Type, Map<String, String[]>> serviceDesiredProperties = new EnumMap<Service.Type, Map<String, String[]>>(Service.Type.class);
- private static final Map<String, Service.Type> componentServiceMap = new HashMap<String, Service.Type>();
+ private static final Map<String, String> serviceConfigVersions = new ConcurrentHashMap<>();
+ private static final Map<Service.Type, String> serviceConfigTypes = new EnumMap<>(Service.Type.class);
+ private static final Map<Service.Type, Map<String, String[]>> serviceDesiredProperties = new EnumMap<>(Service.Type.class);
+ private static final Map<String, Service.Type> componentServiceMap = new HashMap<>();
private static final Map<String, List<HttpPropertyProvider.HttpPropertyRequest>> 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<String, Map<String, String[]>> jmxDesiredProperties = new HashMap<String, Map<String, String[]>>();
+ private static final Map<String, Map<String, String[]>> jmxDesiredProperties = new HashMap<>();
private static final Map<String, Map<String, String[]>> jmxDesiredRpcSuffixProperties = new ConcurrentHashMap<>();
- private volatile Map<String, Map<String, Map<String, String>>> jmxDesiredRpcSuffixes = new HashMap<String, Map<String, Map<String,String>>>();
- private volatile Map<String, String> clusterHdfsSiteConfigVersionMap = new HashMap<String, String>();
+ private volatile Map<String, Map<String, Map<String, String>>> jmxDesiredRpcSuffixes = new HashMap<>();
+ private volatile Map<String, String> clusterHdfsSiteConfigVersionMap = new HashMap<>();
private volatile Map<String, String> 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<String, String[]> initPropMap = new HashMap<String, String[]>();
+ Map<String, String[]> 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<String, String[]>();
+ 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<String, String[]>();
+ 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<String, String[]>();
+ 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<String, String[]>();
+ initPropMap = new HashMap<>();
initPropMap.put("NAMENODE", new String[]{"dfs.http.policy"});
jmxDesiredProperties.put("NAMENODE", initPropMap);
- initPropMap = new HashMap<String, String[]>();
+ initPropMap = new HashMap<>();
initPropMap.put("DATANODE", new String[]{"dfs.http.policy"});
jmxDesiredProperties.put("DATANODE", initPropMap);
- initPropMap = new HashMap<String, String[]>();
+ initPropMap = new HashMap<>();
initPropMap.put("JOURNALNODE", new String[]{"dfs.http.policy"});
jmxDesiredProperties.put("JOURNALNODE", initPropMap);
- initPropMap = new HashMap<String, String[]>();
+ initPropMap = new HashMap<>();
initPropMap.put("RESOURCEMANAGER", new String[]{"yarn.http.policy"});
jmxDesiredProperties.put("RESOURCEMANAGER", initPropMap);
- initPropMap = new HashMap<String, String[]>();
+ initPropMap = new HashMap<>();
initPropMap.put("HBASE_MASTER", new String[]{"hbase.ssl.enabled"});
jmxDesiredProperties.put("HBASE_MASTER", initPropMap);
- initPropMap = new HashMap<String, String[]>();
+ initPropMap = new HashMap<>();
initPropMap.put("HBASE_REGIONSERVER", new String[]{"hbase.ssl.enabled"});
jmxDesiredProperties.put("HBASE_REGIONSERVER", initPropMap);
- initPropMap = new HashMap<String, String[]>();
+ initPropMap = new HashMap<>();
initPropMap.put("NODEMANAGER", new String[]{"yarn.http.policy"});
jmxDesiredProperties.put("NODEMANAGER", initPropMap);
- initPropMap = new HashMap<String, String[]>();
+ initPropMap = new HashMap<>();
initPropMap.put("HISTORYSERVER", new String[]{"mapreduce.jobhistory.http.policy"});
jmxDesiredProperties.put("HISTORYSERVER", initPropMap);
- initPropMap = new HashMap<String, String[]>();
+ 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<String, String[]>();
+ 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<Resource.Type, ResourceProvider> resourceProviders = new HashMap<Resource.Type, ResourceProvider>();
+ private final Map<Resource.Type, ResourceProvider> resourceProviders = new HashMap<>();
/**
* The map of lists of property providers.
*/
- private final Map<Resource.Type, List<PropertyProvider>> propertyProviders = new HashMap<Resource.Type, List<PropertyProvider>>();
+ private final Map<Resource.Type, List<PropertyProvider>> 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<String, ConcurrentMap<String, String>>();
+ clusterJmxPorts = new ConcurrentHashMap<>();
jmxPortMap.put(clusterName, clusterJmxPorts);
}
}
@@ -528,7 +528,7 @@ public abstract class AbstractProviderModule implements ProviderModule,
serviceConfigTypes.get(service)
);
- Map<String, String[]> componentPortsProperties = new HashMap<String, String[]>();
+ Map<String, String[]> 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<String, String> properties, Set<String> prevProps) {
if (value != null && key != null && value.contains("${")) {
if (prevProps == null) {
- prevProps = new HashSet<String>();
+ prevProps = new HashSet<>();
}
if (prevProps.contains(key)) {
return value;
}
prevProps.add(key);
String refValueString = value;
- Map<String, String> refMap = new HashMap<String, String>();
+ Map<String, String> 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<PropertyProvider> providers = new LinkedList<PropertyProvider>();
+ List<PropertyProvider> 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<String> propertyIds = new HashSet<String>();
+ Set<String> propertyIds = new HashSet<>();
propertyIds.add(ClusterResourceProvider.CLUSTER_NAME_PROPERTY_ID);
- Map<String, String> requestInfoProperties = new HashMap<String, String>();
+ Map<String, String> 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<Resource> clusters = provider.getResources(request, null);
- clusterHostComponentMap = new HashMap<String, Map<String, String>>();
- clusterGangliaCollectorMap = new HashMap<String, String>();
+ clusterHostComponentMap = new HashMap<>();
+ clusterGangliaCollectorMap = new HashMap<>();
for (Resource cluster : clusters) {
@@ -864,7 +864,7 @@ public abstract class AbstractProviderModule implements ProviderModule,
Map<String, String> hostComponentMap = clusterHostComponentMap.get(clusterName);
if (hostComponentMap == null) {
- hostComponentMap = new HashMap<String, String>();
+ 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<String, String> mConfigs = new HashMap<String, String>();
+ Map<String, String> mConfigs = new HashMap<>();
if (!configProperties.isEmpty()) {
Map<String, String> evaluatedProperties = null;
for (Entry<String, String[]> entry : keys.entrySet()) {
@@ -1004,7 +1004,7 @@ public abstract class AbstractProviderModule implements ProviderModule,
if (value != null && value.contains("${")) {
if (evaluatedProperties == null) {
- evaluatedProperties = new HashMap<String, String>();
+ evaluatedProperties = new HashMap<>();
for (Map.Entry<String, Object> subentry : configProperties.entrySet()) {
String keyString = subentry.getKey();
Object object = subentry.getValue();
http://git-wip-us.apache.org/repos/asf/ambari/blob/e8080350/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<ResourceProviderObserver> observers = new HashSet<ResourceProviderObserver>();
+ private final Set<ResourceProviderObserver> 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<Predicate> predicates = visitor.getSimplifiedPredicates();
- Set<Map<String, Object>> propertyMaps = new HashSet<Map<String, Object>>();
+ Set<Map<String, Object>> 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<Map<String, Object>> getPropertyMaps(Map<String, Object> requestPropertyMap, Predicate givenPredicate)
throws UnsupportedPropertyException, SystemException, NoSuchResourceException, NoSuchParentResourceException {
- Set<Map<String, Object>> propertyMaps = new HashSet<Map<String, Object>>();
+ Set<Map<String, Object>> 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<String, Object> propertyMap = new HashMap<String, Object>(PredicateHelper.getProperties(givenPredicate));
+ Map<String, Object> propertyMap = new HashMap<>(PredicateHelper.getProperties(givenPredicate));
propertyMap.putAll(requestPropertyMap);
propertyMaps.add(propertyMap);
} else {
for (Resource resource : getResources(givenPredicate)) {
- Map<String, Object> propertyMap = new HashMap<String, Object>(PropertyHelper.getProperties(resource));
+ Map<String, Object> 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<ConfigurationRequest> getConfigurationRequests(String parentCategory, Map<String, Object> properties) {
- List<ConfigurationRequest> configs = new LinkedList<ConfigurationRequest>();
+ List<ConfigurationRequest> 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<String, Map<String, String>> configAttributesMap = config.getPropertiesAttributes();
if (null == configAttributesMap) {
- configAttributesMap = new HashMap<String, Map<String,String>>();
+ configAttributesMap = new HashMap<>();
config.setPropertiesAttributes(configAttributesMap);
}
Map<String, String> attributesMap = configAttributesMap.get(attributeName);
if (null == attributesMap) {
- attributesMap = new HashMap<String, String>();
+ attributesMap = new HashMap<>();
configAttributesMap.put(attributeName, attributesMap);
}
attributesMap.put(propName, propValue);
http://git-wip-us.apache.org/repos/asf/ambari/blob/e8080350/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<String> pkPropertyIds = new HashSet<String>(
- Arrays.asList(new String[]{ACTION_NAME_PROPERTY_ID}));
+ private static Set<String> pkPropertyIds = new HashSet<>(
+ Arrays.asList(new String[]{ACTION_NAME_PROPERTY_ID}));
public ActionResourceProvider(Set<String> propertyIds,
Map<Type, String> keyPropertyIds,
@@ -96,7 +96,7 @@ public class ActionResourceProvider extends AbstractControllerResourceProvider {
throws SystemException, UnsupportedPropertyException,
NoSuchResourceException, NoSuchParentResourceException {
- final Set<ActionRequest> requests = new HashSet<ActionRequest>();
+ final Set<ActionRequest> requests = new HashSet<>();
if (predicate != null) {
for (Map<String, Object> propertyMap : getPropertyMaps(predicate)) {
ActionRequest actionReq = getRequest(propertyMap);
@@ -117,7 +117,7 @@ public class ActionResourceProvider extends AbstractControllerResourceProvider {
});
Set<String> requestedIds = getRequestPropertyIds(request, predicate);
- Set<Resource> resources = new HashSet<Resource>();
+ Set<Resource> 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<ActionResponse> getActionDefinitions(Set<ActionRequest> requests)
throws AmbariException {
- Set<ActionResponse> responses = new HashSet<ActionResponse>();
+ Set<ActionResponse> responses = new HashSet<>();
for (ActionRequest request : requests) {
if (request.getActionName() == null) {
List<ActionDefinition> ads = getAmbariMetaInfo().getAllActionDefinition();
http://git-wip-us.apache.org/repos/asf/ambari/blob/e8080350/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<String> pkPropertyIds = new HashSet<String>();
+ private static Set<String> pkPropertyIds = new HashSet<>();
@SuppressWarnings("serial")
- public static Set<String> propertyIds = new HashSet<String>();
+ public static Set<String> propertyIds = new HashSet<>();
@SuppressWarnings("serial")
- public static Map<Type, String> keyPropertyIds = new HashMap<Type, String>();
+ public static Map<Type, String> keyPropertyIds = new HashMap<>();
static {
pkPropertyIds.add(WIDGETLAYOUT_ID_PROPERTY_ID);
@@ -141,11 +141,11 @@ public class ActiveWidgetLayoutResourceProvider extends AbstractControllerResour
@Override
public Set<Resource> getResources(Request request, Predicate predicate)
throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
- final Set<Resource> resources = new HashSet<Resource>();
+ final Set<Resource> resources = new HashSet<>();
final Set<String> requestedIds = getRequestPropertyIds(request, predicate);
final Set<Map<String, Object>> propertyMaps = getPropertyMaps(predicate);
- List<WidgetLayoutEntity> layoutEntities = new ArrayList<WidgetLayoutEntity>();
+ List<WidgetLayoutEntity> 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<HashMap> widgets = new ArrayList<HashMap>();
+ List<HashMap> widgets = new ArrayList<>();
List<WidgetLayoutUserWidgetEntity> widgetLayoutUserWidgetEntityList = layoutEntity.getListWidgetLayoutUserWidgetEntity();
for (WidgetLayoutUserWidgetEntity widgetLayoutUserWidgetEntity : widgetLayoutUserWidgetEntityList) {
WidgetEntity widgetEntity = widgetLayoutUserWidgetEntity.getWidget();
- HashMap<String, Object> widgetInfoMap = new HashMap<String, Object>();
+ HashMap<String, Object> widgetInfoMap = new HashMap<>();
widgetInfoMap.put("WidgetInfo",WidgetResponse.coerce(widgetEntity));
widgets.add(widgetInfoMap);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/e8080350/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<String> pkPropertyIds = new HashSet<String>(
- Arrays.asList(ALERT_DEF_ID, ALERT_DEF_NAME));
+ private static Set<String> 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<String> PROPERTY_IDS = new HashSet<String>();
+ private static final Set<String> PROPERTY_IDS = new HashSet<>();
/**
* The key property ids for an alert definition resource.
*/
- private static final Map<Resource.Type, String> KEY_PROPERTY_IDS = new HashMap<Resource.Type, String>();
+ private static final Map<Resource.Type, String> KEY_PROPERTY_IDS = new HashMap<>();
static {
// properties
@@ -195,7 +195,7 @@ public class AlertDefinitionResourceProvider extends AbstractControllerResourceP
private void createAlertDefinitions(Set<Map<String, Object>> requestMaps)
throws AmbariException, AuthorizationException {
- List<AlertDefinitionEntity> entities = new ArrayList<AlertDefinitionEntity>();
+ List<AlertDefinitionEntity> entities = new ArrayList<>();
String clusterName = null;
for (Map<String, Object> requestMap : requestMaps) {
@@ -232,7 +232,7 @@ public class AlertDefinitionResourceProvider extends AbstractControllerResourceP
Set<String> requestPropertyIds = getRequestPropertyIds(request, predicate);
// use a collection which preserves order since JPA sorts the results
- Set<Resource> results = new LinkedHashSet<Resource>();
+ Set<Resource> results = new LinkedHashSet<>();
for (Map<String, Object> propertyMap : getPropertyMaps(predicate)) {
String clusterName = (String) propertyMap.get(ALERT_DEF_CLUSTER_NAME);
@@ -354,7 +354,7 @@ public class AlertDefinitionResourceProvider extends AbstractControllerResourceP
Set<Resource> resources = getResources(
new RequestImpl(null, null, null, null), predicate);
- Set<Long> definitionIds = new HashSet<Long>();
+ Set<Long> 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<String,JsonObject> jsonObjectMapping = new HashMap<String, JsonObject>();
+ Map<String,JsonObject> 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/e8080350/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<String> PK_PROPERTY_IDS = new HashSet<String>(
- Arrays.asList(ALERT_GROUP_ID, ALERT_GROUP_CLUSTER_NAME));
+ private static final Set<String> 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<String> PROPERTY_IDS = new HashSet<String>();
+ private static final Set<String> PROPERTY_IDS = new HashSet<>();
/**
* The key property ids for an alert group resource.
*/
- private static final Map<Resource.Type, String> KEY_PROPERTY_IDS = new HashMap<Resource.Type, String>();
+ private static final Map<Resource.Type, String> KEY_PROPERTY_IDS = new HashMap<>();
static {
// properties
@@ -140,7 +140,7 @@ public class AlertGroupResourceProvider extends
throws SystemException, UnsupportedPropertyException,
NoSuchResourceException, NoSuchParentResourceException {
- Set<Resource> results = new HashSet<Resource>();
+ Set<Resource> results = new HashSet<>();
Set<String> requestPropertyIds = getRequestPropertyIds(request, predicate);
for (Map<String, Object> propertyMap : getPropertyMaps(predicate)) {
@@ -213,7 +213,7 @@ public class AlertGroupResourceProvider extends
Set<Resource> resources = getResources(new RequestImpl(null, null, null,
null), predicate);
- Map<Long, AlertGroupEntity> entities = new HashMap<Long, AlertGroupEntity>();
+ Map<Long, AlertGroupEntity> 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<Map<String, Object>> requestMaps)
throws AmbariException, AuthorizationException {
- List<AlertGroupEntity> entities = new ArrayList<AlertGroupEntity>();
+ List<AlertGroupEntity> entities = new ArrayList<>();
for (Map<String, Object> 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<Long> targetIds = (List<Long>) requestMap.get(ALERT_GROUP_TARGETS);
- Set<AlertTargetEntity> targets = new HashSet<AlertTargetEntity>();
+ Set<AlertTargetEntity> 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<Long> definitionIds = (List<Long>) requestMap.get(ALERT_GROUP_DEFINITIONS);
- Set<AlertDefinitionEntity> definitions = new HashSet<AlertDefinitionEntity>();
+ Set<AlertDefinitionEntity> 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<AlertTargetEntity> targets = new HashSet<AlertTargetEntity>();
+ Set<AlertTargetEntity> targets = new HashSet<>();
- List<Long> ids = new ArrayList<Long>(targetIds.size());
+ List<Long> 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<AlertDefinitionEntity> definitions = new HashSet<AlertDefinitionEntity>();
+ Set<AlertDefinitionEntity> definitions = new HashSet<>();
if (null != definitionIds && definitionIds.size() > 0) {
- List<Long> ids = new ArrayList<Long>(definitionIds.size());
+ List<Long> 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<AlertDefinitionEntity> definitions = entity.getAlertDefinitions();
- List<AlertDefinitionResponse> definitionList = new ArrayList<AlertDefinitionResponse>(
- definitions.size());
+ List<AlertDefinitionResponse> 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<AlertTargetEntity> targetEntities = entity.getAlertTargets();
- List<AlertTarget> targets = new ArrayList<AlertTarget>(
- targetEntities.size());
+ List<AlertTarget> targets = new ArrayList<>(
+ targetEntities.size());
for (AlertTargetEntity targetEntity : targetEntities) {
AlertTarget target = AlertTarget.coerce(targetEntity);
http://git-wip-us.apache.org/repos/asf/ambari/blob/e8080350/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<String> PK_PROPERTY_IDS = new HashSet<String>(
- Arrays.asList(ALERT_HISTORY_ID));
+ private static final Set<String> 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<String> PROPERTY_IDS = new HashSet<String>();
+ private static final Set<String> PROPERTY_IDS = new HashSet<>();
/**
* The key property ids for an alert history resource.
*/
private static final Map<Resource.Type, String> KEY_PROPERTY_IDS =
- new HashMap<Resource.Type, String>();
+ new HashMap<>();
static {
// properties
@@ -199,7 +199,7 @@ public class AlertHistoryResourceProvider extends ReadOnlyResourceProvider imple
}
}
- Set<Resource> results = new LinkedHashSet<Resource>();
+ Set<Resource> results = new LinkedHashSet<>();
Set<String> requestPropertyIds = getRequestPropertyIds(request, predicate);
AlertHistoryRequest historyRequest = new AlertHistoryRequest();