http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/api/services/ValidationService.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ValidationService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ValidationService.java index 87cb6ac..b5b4a42 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ValidationService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ValidationService.java @@ -60,7 +60,7 @@ public class ValidationService extends BaseService { } ResourceInstance createValidationResource(String stackName, String stackVersion) { - Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>(); + Map<Resource.Type, String> mapIds = new HashMap<>(); mapIds.put(Resource.Type.Stack, stackName); mapIds.put(Resource.Type.StackVersion, stackVersion);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/api/services/VersionDefinitionService.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/VersionDefinitionService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/VersionDefinitionService.java index 6410bd8..af1eb07 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/VersionDefinitionService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/VersionDefinitionService.java @@ -70,7 +70,7 @@ public class VersionDefinitionService extends BaseService { */ @Path("{versionNumber}/operating_systems") public OperatingSystemService getOperatingSystemsHandler(@PathParam("versionNumber") String versionNumber) { - final Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>(); + final Map<Resource.Type, String> mapIds = new HashMap<>(); mapIds.put(Resource.Type.VersionDefinition, versionNumber); return new OperatingSystemService(mapIds); } http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewExternalSubResourceService.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewExternalSubResourceService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewExternalSubResourceService.java index 66ccae7..515d4ac 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewExternalSubResourceService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewExternalSubResourceService.java @@ -64,7 +64,7 @@ public class ViewExternalSubResourceService extends BaseService { /** * Mapping of resource names to services. */ - private final Map<String, Object> resourceServiceMap = new HashMap<String, Object>(); + private final Map<String, Object> resourceServiceMap = new HashMap<>(); // ----- Constructors ------------------------------------------------------ @@ -137,7 +137,7 @@ public class ViewExternalSubResourceService extends BaseService { * @return a view instance resource */ private ResourceInstance createResource(String viewName, String instanceName) { - Map<Resource.Type,String> mapIds = new HashMap<Resource.Type, String>(); + Map<Resource.Type,String> mapIds = new HashMap<>(); mapIds.put(Resource.Type.View, viewName); mapIds.put(Resource.Type.ViewVersion, version); mapIds.put(Resource.Type.ViewInstance, instanceName); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewInstanceService.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewInstanceService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewInstanceService.java index 53d4918..b10738d 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewInstanceService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewInstanceService.java @@ -257,7 +257,7 @@ public class ViewInstanceService extends BaseService { * @return a view instance resource */ private ResourceInstance createResource(String viewName, String viewVersion, String instanceName) { - Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>(); + Map<Resource.Type, String> mapIds = new HashMap<>(); mapIds.put(Resource.Type.View, viewName); mapIds.put(Resource.Type.ViewVersion, viewVersion); mapIds.put(Resource.Type.ViewInstance, instanceName); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewPermissionService.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewPermissionService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewPermissionService.java index 8f7f4ef..86bfa14 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewPermissionService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewPermissionService.java @@ -176,7 +176,7 @@ public class ViewPermissionService extends BaseService { * @return a permission resource instance */ protected ResourceInstance createPermissionResource(String viewName, String viewVersion, String permissionId) { - Map<Resource.Type,String> mapIds = new HashMap<Resource.Type, String>(); + Map<Resource.Type,String> mapIds = new HashMap<>(); mapIds.put(Resource.Type.View, viewName); mapIds.put(Resource.Type.ViewVersion, viewVersion); mapIds.put(Resource.Type.ViewPermission, permissionId); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewPrivilegeService.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewPrivilegeService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewPrivilegeService.java index 7393745..34dd4c2 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewPrivilegeService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewPrivilegeService.java @@ -43,7 +43,7 @@ public class ViewPrivilegeService extends PrivilegeService { @Override protected ResourceInstance createPrivilegeResource(String privilegeId) { - Map<Resource.Type,String> mapIds = new HashMap<Resource.Type, String>(); + Map<Resource.Type,String> mapIds = new HashMap<>(); mapIds.put(Resource.Type.View, viewName); mapIds.put(Resource.Type.ViewVersion, viewVersion); mapIds.put(Resource.Type.ViewInstance, instanceName); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewSubResourceService.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewSubResourceService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewSubResourceService.java index 76d28fe..6e00d10 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewSubResourceService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewSubResourceService.java @@ -92,7 +92,7 @@ public class ViewSubResourceService extends BaseService implements ViewResourceH // create a resource with the given id protected ResourceInstance createResource(String resourceId) { - Map<Resource.Type,String> mapIds = new HashMap<Resource.Type,String>(); + Map<Resource.Type,String> mapIds = new HashMap<>(); mapIds.put(Resource.Type.View, viewName); mapIds.put(Resource.Type.ViewVersion, version); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewVersionService.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewVersionService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewVersionService.java index 3554da1..c10bf00 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewVersionService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ViewVersionService.java @@ -191,7 +191,7 @@ public class ViewVersionService extends BaseService { * @return a view resource instance */ private ResourceInstance createResource(String viewName, String version) { - Map<Resource.Type,String> mapIds = new HashMap<Resource.Type, String>(); + Map<Resource.Type,String> mapIds = new HashMap<>(); mapIds.put(Resource.Type.View, viewName); mapIds.put(Resource.Type.ViewVersion, version); return createResource(Resource.Type.ViewVersion, mapIds); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetLayoutService.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetLayoutService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetLayoutService.java index 51d85ea..4886165 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetLayoutService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetLayoutService.java @@ -116,7 +116,7 @@ public class WidgetLayoutService extends BaseService { } private ResourceInstance createResource(String widgetLayoutId) { - Map<Resource.Type,String> mapIds = new HashMap<Resource.Type, String>(); + Map<Resource.Type,String> mapIds = new HashMap<>(); mapIds.put(Resource.Type.WidgetLayout, widgetLayoutId); mapIds.put(Resource.Type.Cluster, clusterName); return createResource(Resource.Type.WidgetLayout, mapIds); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetService.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetService.java index d6aa768..e0fe801 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/WidgetService.java @@ -116,7 +116,7 @@ public class WidgetService extends BaseService { } private ResourceInstance createResource(String widgetId) { - Map<Resource.Type,String> mapIds = new HashMap<Resource.Type, String>(); + Map<Resource.Type,String> mapIds = new HashMap<>(); mapIds.put(Resource.Type.Cluster, clusterName); mapIds.put(Resource.Type.Widget, widgetId); return createResource(Resource.Type.Widget, mapIds); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/api/services/WorkflowService.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/WorkflowService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/WorkflowService.java index 53ad919..abffedd 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/WorkflowService.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/WorkflowService.java @@ -104,7 +104,7 @@ public class WorkflowService extends BaseService { * @return a workflow resource instance */ ResourceInstance createWorkflowResource(String clusterName, String workflowId) { - Map<Resource.Type,String> mapIds = new HashMap<Resource.Type,String>(); + Map<Resource.Type,String> mapIds = new HashMap<>(); mapIds.put(Resource.Type.Cluster, clusterName); mapIds.put(Resource.Type.Workflow, workflowId); return createResource(Resource.Type.Workflow, mapIds); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/api/services/parsers/JsonRequestBodyParser.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/parsers/JsonRequestBodyParser.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/parsers/JsonRequestBodyParser.java index 75ac0f3..c3e0386 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/parsers/JsonRequestBodyParser.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/parsers/JsonRequestBodyParser.java @@ -48,7 +48,7 @@ public class JsonRequestBodyParser implements RequestBodyParser { @Override public Set<RequestBody> parse(String body) throws BodyParseException { - Set<RequestBody> requestBodySet = new HashSet<RequestBody>(); + Set<RequestBody> requestBodySet = new HashSet<>(); RequestBody rootBody = new RequestBody(); rootBody.setBody(body); @@ -60,8 +60,8 @@ public class JsonRequestBodyParser implements RequestBodyParser { Iterator<JsonNode> iterator = root.getElements(); while (iterator.hasNext()) { JsonNode node = iterator.next(); - Map<String, Object> mapProperties = new HashMap<String, Object>(); - Map<String, String> requestInfoProps = new HashMap<String, String>(); + Map<String, Object> mapProperties = new HashMap<>(); + Map<String, String> requestInfoProps = new HashMap<>(); NamedPropertySet propertySet = new NamedPropertySet("", mapProperties); processNode(node, "", propertySet, requestInfoProps); @@ -119,8 +119,8 @@ public class JsonRequestBodyParser implements RequestBodyParser { if (child.isArray()) { //array Iterator<JsonNode> arrayIter = child.getElements(); - Set<Map<String, Object>> arraySet = new LinkedHashSet<Map<String, Object>>(); - List<String> primitives = new ArrayList<String>(); + Set<Map<String, Object>> arraySet = new LinkedHashSet<>(); + List<String> primitives = new ArrayList<>(); while (arrayIter.hasNext()) { JsonNode next = arrayIter.next(); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/api/services/serializers/CsvSerializer.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/serializers/CsvSerializer.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/serializers/CsvSerializer.java index 760eecb..db94058 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/serializers/CsvSerializer.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/serializers/CsvSerializer.java @@ -147,7 +147,7 @@ public class CsvSerializer implements ResultSerializer { if (node != null) { Resource recordResource = node.getObject(); if (recordResource != null) { - List<Object> values = new ArrayList<Object>(); + List<Object> values = new ArrayList<>(); if (fieldNameOrder != null) { for (String fieldName : fieldNameOrder) { @@ -208,14 +208,14 @@ public class CsvSerializer implements ResultSerializer { fieldNameOrder = (List<String>) object; } else if (header != null) { // Use the ordering specified by the map. - fieldNameOrder = new ArrayList<String>(header.keySet()); + fieldNameOrder = new ArrayList<>(header.keySet()); } else { fieldNameOrder = null; } if (header != null) { // build the header record - List<String> headerNames = new ArrayList<String>(); + List<String> headerNames = new ArrayList<>(); for (String fieldName : fieldNameOrder) { headerNames.add(header.get(fieldName)); } http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java index 4e1b3c1..0abcc14 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessor.java @@ -68,7 +68,7 @@ public class StackAdvisorBlueprintProcessor { private static final Map<String, String> userContext; static { - userContext = new HashMap<String, String>(); + userContext = new HashMap<>(); userContext.put("operation", "ClusterCreate"); } @@ -97,7 +97,7 @@ public class StackAdvisorBlueprintProcessor { hgHostsMap); return StackAdvisorRequest.StackAdvisorRequestBuilder .forStack(stack.getName(), stack.getVersion()) - .forServices(new ArrayList<String>(clusterTopology.getBlueprint().getServices())) + .forServices(new ArrayList<>(clusterTopology.getBlueprint().getServices())) .forHosts(gatherHosts(clusterTopology)) .forHostsGroupBindings(gatherHostGroupBindings(clusterTopology)) .forHostComponents(gatherHostGroupComponents(clusterTopology)) @@ -136,7 +136,7 @@ public class StackAdvisorBlueprintProcessor { } private Map<String, Set<String>> gatherComponentsHostsMap(Map<String, Set<String>> hostGroups, Map<String, Set<String>> bindingHostGroups) { - Map<String, Set<String>> componentHostsMap = new HashMap<String, Set<String>>(); + Map<String, Set<String>> componentHostsMap = new HashMap<>(); if (null != bindingHostGroups && null != hostGroups) { for (Map.Entry<String, Set<String>> hgComponents : hostGroups.entrySet()) { String hgName = hgComponents.getKey(); @@ -147,7 +147,7 @@ public class StackAdvisorBlueprintProcessor { for (String component : components) { Set<String> componentHosts = componentHostsMap.get(component); if (componentHosts == null) { // if was not initialized - componentHosts = new HashSet<String>(); + componentHosts = new HashSet<>(); componentHostsMap.put(component, componentHosts); } componentHosts.addAll(hosts); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorRequest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorRequest.java index 044e143..f5677c1 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorRequest.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorRequest.java @@ -38,15 +38,15 @@ public class StackAdvisorRequest { private String stackName; private String stackVersion; private StackAdvisorRequestType requestType; - private List<String> hosts = new ArrayList<String>(); - private List<String> services = new ArrayList<String>(); - private Map<String, Set<String>> componentHostsMap = new HashMap<String, Set<String>>(); - private Map<String, Set<String>> hostComponents = new HashMap<String, Set<String>>(); - private Map<String, Set<String>> hostGroupBindings = new HashMap<String, Set<String>>(); - private Map<String, Map<String, Map<String, String>>> configurations = new HashMap<String, Map<String, Map<String, String>>>(); - private List<ChangedConfigInfo> changedConfigurations = new LinkedList<ChangedConfigInfo>(); + private List<String> hosts = new ArrayList<>(); + private List<String> services = new ArrayList<>(); + private Map<String, Set<String>> componentHostsMap = new HashMap<>(); + private Map<String, Set<String>> hostComponents = new HashMap<>(); + private Map<String, Set<String>> hostGroupBindings = new HashMap<>(); + private Map<String, Map<String, Map<String, String>>> configurations = new HashMap<>(); + private List<ChangedConfigInfo> changedConfigurations = new LinkedList<>(); private Set<RecommendationResponse.ConfigGroup> configGroups; - private Map<String, String> userContext = new HashMap<String, String>(); + private Map<String, String> userContext = new HashMap<>(); public String getStackName() { return stackName; http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorRunner.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorRunner.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorRunner.java index f3b61bd..9608922 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorRunner.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorRunner.java @@ -127,7 +127,7 @@ public class StackAdvisorRunner { String servicesFile = actionDirectory + File.separator + "services.json"; // includes the original command plus the arguments for it - List<String> builderParameters = new ArrayList<String>(); + List<String> builderParameters = new ArrayList<>(); if (System.getProperty("os.name").contains("Windows")) { builderParameters.add("cmd"); builderParameters.add("/c"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationDependenciesRecommendationCommand.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationDependenciesRecommendationCommand.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationDependenciesRecommendationCommand.java index 381062f..6a2adfa 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationDependenciesRecommendationCommand.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationDependenciesRecommendationCommand.java @@ -70,15 +70,15 @@ public class ConfigurationDependenciesRecommendationCommand extends } protected Set<HostGroup> processHostGroups(StackAdvisorRequest request) { - Set<HostGroup> resultSet = new HashSet<HostGroup>(); + Set<HostGroup> resultSet = new HashSet<>(); for (Map.Entry<String, Set<String>> componentHost : request.getHostComponents().entrySet()) { String hostGroupName = componentHost.getKey(); Set<String> components = componentHost.getValue(); if (hostGroupName != null && components != null) { HostGroup hostGroup = new HostGroup(); - Set<Map<String, String>> componentsSet = new HashSet<Map<String, String>>(); + Set<Map<String, String>> componentsSet = new HashSet<>(); for (String component : components) { - Map<String, String> componentMap = new HashMap<String, String>(); + Map<String, String> componentMap = new HashMap<>(); componentMap.put("name", component); componentsSet.add(componentMap); } @@ -91,15 +91,15 @@ public class ConfigurationDependenciesRecommendationCommand extends } private Set<BindingHostGroup> processHostGroupBindings(StackAdvisorRequest request) { - Set<BindingHostGroup> resultSet = new HashSet<BindingHostGroup>(); + Set<BindingHostGroup> resultSet = new HashSet<>(); for (Map.Entry<String, Set<String>> hostBinding : request.getHostGroupBindings().entrySet()) { String hostGroupName = hostBinding.getKey(); Set<String> hosts = hostBinding.getValue(); if (hostGroupName != null && hosts != null) { BindingHostGroup bindingHostGroup = new BindingHostGroup(); - Set<Map<String, String>> hostsSet = new HashSet<Map<String, String>>(); + Set<Map<String, String>> hostsSet = new HashSet<>(); for (String host : hosts) { - Map<String, String> hostMap = new HashMap<String, String>(); + Map<String, String> hostMap = new HashMap<>(); hostMap.put("name", host); hostsSet.add(hostMap); } http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationRecommendationCommand.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationRecommendationCommand.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationRecommendationCommand.java index 4299282..6eaf19e 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationRecommendationCommand.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationRecommendationCommand.java @@ -66,15 +66,15 @@ public class ConfigurationRecommendationCommand extends } protected Set<HostGroup> processHostGroups(StackAdvisorRequest request) { - Set<HostGroup> resultSet = new HashSet<HostGroup>(); + Set<HostGroup> resultSet = new HashSet<>(); for (Map.Entry<String, Set<String>> componentHost : request.getHostComponents().entrySet()) { String hostGroupName = componentHost.getKey(); Set<String> components = componentHost.getValue(); if (hostGroupName != null && components != null) { HostGroup hostGroup = new HostGroup(); - Set<Map<String, String>> componentsSet = new HashSet<Map<String, String>>(); + Set<Map<String, String>> componentsSet = new HashSet<>(); for (String component : components) { - Map<String, String> componentMap = new HashMap<String, String>(); + Map<String, String> componentMap = new HashMap<>(); componentMap.put("name", component); componentsSet.add(componentMap); } @@ -87,15 +87,15 @@ public class ConfigurationRecommendationCommand extends } private Set<BindingHostGroup> processHostGroupBindings(StackAdvisorRequest request) { - Set<BindingHostGroup> resultSet = new HashSet<BindingHostGroup>(); + Set<BindingHostGroup> resultSet = new HashSet<>(); for (Map.Entry<String, Set<String>> hostBinding : request.getHostGroupBindings().entrySet()) { String hostGroupName = hostBinding.getKey(); Set<String> hosts = hostBinding.getValue(); if (hostGroupName != null && hosts != null) { BindingHostGroup bindingHostGroup = new BindingHostGroup(); - Set<Map<String, String>> hostsSet = new HashSet<Map<String, String>>(); + Set<Map<String, String>> hostsSet = new HashSet<>(); for (String host : hosts) { - Map<String, String> hostMap = new HashMap<String, String>(); + Map<String, String> hostMap = new HashMap<>(); hostMap.put("name", host); hostsSet.add(hostMap); } http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java index 2cfa8e7..74a2cf2 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/commands/StackAdvisorCommand.java @@ -392,7 +392,7 @@ public abstract class StackAdvisorCommand<T extends StackAdvisorResponse> extend private Collection<String> getUnregisteredHosts(String hostsJSON, List<String> hosts) throws StackAdvisorException { ObjectMapper mapper = new ObjectMapper(); - List<String> registeredHosts = new ArrayList<String>(); + List<String> registeredHosts = new ArrayList<>(); try { JsonNode root = mapper.readTree(hostsJSON); @@ -434,12 +434,12 @@ public abstract class StackAdvisorCommand<T extends StackAdvisorResponse> extend } private ResourceInstance createHostResource() { - Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>(); + Map<Resource.Type, String> mapIds = new HashMap<>(); return createResource(Resource.Type.Host, mapIds); } private ResourceInstance createStackVersionResource(String stackName, String stackVersion) { - Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>(); + Map<Resource.Type, String> mapIds = new HashMap<>(); mapIds.put(Resource.Type.Stack, stackName); mapIds.put(Resource.Type.StackVersion, stackVersion); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/recommendations/RecommendationResponse.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/recommendations/RecommendationResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/recommendations/RecommendationResponse.java index a1253d8..9497b33 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/recommendations/RecommendationResponse.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/recommendations/RecommendationResponse.java @@ -128,7 +128,7 @@ public class RecommendationResponse extends StackAdvisorResponse { public static class BlueprintConfigurations { @JsonProperty - private final Map<String, String> properties = new HashMap<String, String>(); + private final Map<String, String> properties = new HashMap<>(); @JsonProperty("property_attributes") @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) @@ -234,12 +234,12 @@ public class RecommendationResponse extends StackAdvisorResponse { @JsonProperty @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) private Map<String, BlueprintConfigurations> configurations = - new HashMap<String, BlueprintConfigurations>(); + new HashMap<>(); @JsonProperty("dependent_configurations") @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL) private Map<String, BlueprintConfigurations> dependentConfigurations = - new HashMap<String, BlueprintConfigurations>(); + new HashMap<>(); public ConfigGroup() { http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/api/util/TreeNodeImpl.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/util/TreeNodeImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/api/util/TreeNodeImpl.java index c498ad7..4d68c9c 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/api/util/TreeNodeImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/api/util/TreeNodeImpl.java @@ -40,7 +40,7 @@ public class TreeNodeImpl<T> implements TreeNode<T> { /** * child nodes */ - private Map<String, TreeNode<T>> m_mapChildren = new LinkedHashMap<String, TreeNode<T>>(); + private Map<String, TreeNode<T>> m_mapChildren = new LinkedHashMap<>(); /** * associated object @@ -97,7 +97,7 @@ public class TreeNodeImpl<T> implements TreeNode<T> { @Override public TreeNode<T> addChild(T child, String name) { - TreeNodeImpl<T> node = new TreeNodeImpl<T>(this, child, name); + TreeNodeImpl<T> node = new TreeNodeImpl<>(this, child, name); m_mapChildren.put(name, node); return node; @@ -119,7 +119,7 @@ public class TreeNodeImpl<T> implements TreeNode<T> { @Override public void setProperty(String name, Object value) { if (m_mapNodeProps == null) { - m_mapNodeProps = new LinkedHashMap<String, Object>(); + m_mapNodeProps = new LinkedHashMap<>(); } m_mapNodeProps.put(name, value); } http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClusterPrivilegeChangeRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClusterPrivilegeChangeRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClusterPrivilegeChangeRequestAuditEvent.java index dab9719..5b2ceca 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClusterPrivilegeChangeRequestAuditEvent.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ClusterPrivilegeChangeRequestAuditEvent.java @@ -74,7 +74,7 @@ public class ClusterPrivilegeChangeRequestAuditEvent extends RequestAuditEvent { protected void buildAuditMessage(StringBuilder builder) { super.buildAuditMessage(builder); - SortedSet<String> roleSet = new TreeSet<String>(); + SortedSet<String> roleSet = new TreeSet<>(); roleSet.addAll(users.keySet()); roleSet.addAll(groups.keySet()); roleSet.addAll(roles.keySet()); @@ -84,7 +84,7 @@ public class ClusterPrivilegeChangeRequestAuditEvent extends RequestAuditEvent { builder.append(System.lineSeparator()); } - List<String> lines = new LinkedList<String>(); + List<String> lines = new LinkedList<>(); for (String role : roleSet) { lines.add(role + ": "); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ViewPrivilegeChangeRequestAuditEvent.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ViewPrivilegeChangeRequestAuditEvent.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ViewPrivilegeChangeRequestAuditEvent.java index f282b28..2fdb3ef 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ViewPrivilegeChangeRequestAuditEvent.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/event/request/ViewPrivilegeChangeRequestAuditEvent.java @@ -95,7 +95,7 @@ public class ViewPrivilegeChangeRequestAuditEvent extends RequestAuditEvent { .append(name) .append(")"); - SortedSet<String> roleSet = new TreeSet<String>(); + SortedSet<String> roleSet = new TreeSet<>(); roleSet.addAll(users.keySet()); roleSet.addAll(groups.keySet()); roleSet.addAll(roles.keySet()); @@ -105,7 +105,7 @@ public class ViewPrivilegeChangeRequestAuditEvent extends RequestAuditEvent { builder.append(System.lineSeparator()); } - List<String> lines = new LinkedList<String>(); + List<String> lines = new LinkedList<>(); for (String role : roleSet) { lines.add(role + ": "); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/PrivilegeEventCreator.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/PrivilegeEventCreator.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/PrivilegeEventCreator.java index a7be8e1..8f03655 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/PrivilegeEventCreator.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/PrivilegeEventCreator.java @@ -125,7 +125,7 @@ public class PrivilegeEventCreator implements RequestAuditEventCreator { * @return a map of role -> [user|group] names */ private Map<String, List<String>> getEntities(final Request request, final String type) { - Map<String, List<String>> entities = new HashMap<String, List<String>>(); + Map<String, List<String>> entities = new HashMap<>(); for (Map<String, Object> propertyMap : request.getBody().getPropertySets()) { String ptype = String.valueOf(propertyMap.get(PrivilegeResourceProvider.PRINCIPAL_TYPE_PROPERTY_ID)); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/RepositoryVersionEventCreator.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/RepositoryVersionEventCreator.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/RepositoryVersionEventCreator.java index f5a9de7..d324b04 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/RepositoryVersionEventCreator.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/RepositoryVersionEventCreator.java @@ -139,7 +139,7 @@ public class RepositoryVersionEventCreator implements RequestAuditEventCreator { */ private SortedMap<String, List<Map<String, String>>> getRepos(Request request) { - SortedMap<String, List<Map<String, String>>> result = new TreeMap<String, List<Map<String, String>>>(); + SortedMap<String, List<Map<String, String>>> result = new TreeMap<>(); Map<String, Object> first = Iterables.getFirst(request.getBody().getPropertySets(), null); @@ -156,7 +156,7 @@ public class RepositoryVersionEventCreator implements RequestAuditEventCreator { * @return */ private SortedMap<String, List<Map<String, String>>> createResultForOperationSystems(Set<?> set) { - SortedMap<String, List<Map<String, String>>> result = new TreeMap<String, List<Map<String, String>>>(); + SortedMap<String, List<Map<String, String>>> result = new TreeMap<>(); for (Object entry : set) { if (entry instanceof Map) { Map<?, ?> map = (Map<?, ?>) entry; http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/RequestAuditEventCreatorHelper.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/RequestAuditEventCreatorHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/RequestAuditEventCreatorHelper.java index 398b275..306a099 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/RequestAuditEventCreatorHelper.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/RequestAuditEventCreatorHelper.java @@ -83,7 +83,7 @@ public class RequestAuditEventCreatorHelper { * @return */ public static List<String> getPropertyList(Request request, String propertyName) { - List<String> list = new LinkedList<String>(); + List<String> list = new LinkedList<>(); for (Map<String, Object> propertyMap : request.getBody().getPropertySets()) { if (propertyMap.containsKey(propertyName)) { list.add(String.valueOf(propertyMap.get(propertyName))); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/ViewPrivilegeEventCreator.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/ViewPrivilegeEventCreator.java b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/ViewPrivilegeEventCreator.java index 47983ff..3042772 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/ViewPrivilegeEventCreator.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/audit/request/eventcreator/ViewPrivilegeEventCreator.java @@ -110,7 +110,7 @@ public class ViewPrivilegeEventCreator implements RequestAuditEventCreator { * @return a map of role -> [user|group] names */ private Map<String, List<String>> getEntities(final Request request, final String type) { - Map<String, List<String>> entities = new HashMap<String, List<String>>(); + Map<String, List<String>> entities = new HashMap<>(); for (Map<String, Object> propertyMap : request.getBody().getPropertySets()) { String ptype = String.valueOf(propertyMap.get(ViewPrivilegeResourceProvider.PRINCIPAL_TYPE_PROPERTY_ID)); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatusCollector.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatusCollector.java b/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatusCollector.java index 79f6511..8734a2c 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatusCollector.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSHostStatusCollector.java @@ -54,7 +54,7 @@ class BSHostStatusCollector { public void run() { LOG.info("Request directory " + requestIdDir); - hostStatus = new ArrayList<BSHostStatus>(); + hostStatus = new ArrayList<>(); if (hosts == null) { return; } http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSRunner.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSRunner.java b/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSRunner.java index 3040443..cfd55bb 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSRunner.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSRunner.java @@ -243,7 +243,7 @@ class BSRunner extends Thread { command[11] = userRunAs; command[12] = (this.passwordFile==null) ? "null" : this.passwordFile.toString(); - Map<String, String> envVariables = new HashMap<String, String>(); + Map<String, String> envVariables = new HashMap<>(); if (System.getProperty("os.name").contains("Windows")) { String command2[] = new String[command.length + 1]; http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BootStrapImpl.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BootStrapImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BootStrapImpl.java index 0394074..156096d 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BootStrapImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BootStrapImpl.java @@ -60,7 +60,7 @@ public class BootStrapImpl { this.bootScript = conf.getBootStrapScript(); this.bootSetupAgentScript = conf.getBootSetupAgentScript(); this.bootSetupAgentPassword = conf.getBootSetupAgentPassword(); - this.bsStatus = new FifoLinkedHashMap<Long, BootStrapStatus>(); + this.bsStatus = new FifoLinkedHashMap<>(); this.masterHostname = conf.getMasterHostname( InetAddress.getLocalHost().getCanonicalHostName()); this.clusterOsType = conf.getServerOsType(); @@ -141,7 +141,7 @@ public class BootStrapImpl { * @return */ public synchronized List<BSHostStatus> getHostInfo(List<String> hosts) { - List<BSHostStatus> statuses = new ArrayList<BSHostStatus>(); + List<BSHostStatus> statuses = new ArrayList<>(); if (null == hosts || 0 == hosts.size() || (hosts.size() == 1 && hosts.get(0).equals("*"))) { for (BootStrapStatus status : bsStatus.values()) { http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/SshHostInfo.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/SshHostInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/SshHostInfo.java index 9a7490f..3c5e1fa 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/SshHostInfo.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/SshHostInfo.java @@ -40,7 +40,7 @@ public class SshHostInfo { private String sshKey; @XmlElement - private List<String> hosts = new ArrayList<String>(); + private List<String> hosts = new ArrayList<>(); @XmlElement private boolean verbose = false; http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java index 36467c9..dd1fa3c 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/AbstractCheckDescriptor.java @@ -240,7 +240,7 @@ public abstract class AbstractCheckDescriptor { c.getDesiredStackVersion().getStackName(), c.getDesiredStackVersion().getStackVersion()); - LinkedHashSet<String> displays = new LinkedHashSet<String>(); + LinkedHashSet<String> displays = new LinkedHashSet<>(); for (String name : names) { if (services.containsKey(name)) { displays.add(services.get(name).getDisplayName()); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/checks/ClientRetryPropertyCheck.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ClientRetryPropertyCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/ClientRetryPropertyCheck.java index 226d82c..714731d 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/checks/ClientRetryPropertyCheck.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ClientRetryPropertyCheck.java @@ -70,7 +70,7 @@ public class ClientRetryPropertyCheck extends AbstractCheckDescriptor { final Cluster cluster = clustersProvider.get().getCluster(request.getClusterName()); Map<String, Service> services = cluster.getServices(); - List<String> errorMessages = new ArrayList<String>(); + List<String> errorMessages = new ArrayList<>(); // HDFS needs to actually prevent client retry since that causes them to try too long and not failover quickly. if (services.containsKey("HDFS")) { http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/checks/ComponentsInstallationCheck.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ComponentsInstallationCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/ComponentsInstallationCheck.java index 09872f2..70a061c 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/checks/ComponentsInstallationCheck.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ComponentsInstallationCheck.java @@ -62,12 +62,12 @@ public class ComponentsInstallationCheck extends AbstractCheckDescriptor { public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException { final String clusterName = request.getClusterName(); final Cluster cluster = clustersProvider.get().getCluster(clusterName); - Set<String> failedServiceNames = new HashSet<String>(); + Set<String> failedServiceNames = new HashSet<>(); StackId stackId = cluster.getCurrentStackVersion(); // Preq-req check should fail if any service component is in INSTALL_FAILED state - Set<String> installFailedHostComponents = new HashSet<String>(); + Set<String> installFailedHostComponents = new HashSet<>(); for (Map.Entry<String, Service> serviceEntry : cluster.getServices().entrySet()) { final Service service = serviceEntry.getValue(); @@ -99,7 +99,7 @@ public class ComponentsInstallationCheck extends AbstractCheckDescriptor { if(!installFailedHostComponents.isEmpty()) { String message = MessageFormat.format("Service components in INSTALL_FAILED state: {0}.", StringUtils.join(installFailedHostComponents, ", ")); - prerequisiteCheck.setFailedOn(new LinkedHashSet<String>(failedServiceNames)); + prerequisiteCheck.setFailedOn(new LinkedHashSet<>(failedServiceNames)); prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL); prerequisiteCheck.setFailReason( "Found service components in INSTALL_FAILED state. Please re-install these components. " + message); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/checks/ConfigurationMergeCheck.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ConfigurationMergeCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/ConfigurationMergeCheck.java index c5e3807..bb571ed 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/checks/ConfigurationMergeCheck.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ConfigurationMergeCheck.java @@ -69,7 +69,7 @@ public class ConfigurationMergeCheck extends AbstractCheckDescriptor { Map<String, Map<String, ThreeWayValue>> changes = m_mergeHelper.getConflicts(request.getClusterName(), rve.getStackId()); - Set<String> failedTypes = new HashSet<String>(); + Set<String> failedTypes = new HashSet<>(); for (Entry<String, Map<String, ThreeWayValue>> entry : changes.entrySet()) { for (Entry<String, ThreeWayValue> configEntry : entry.getValue().entrySet()) { http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/checks/HealthCheck.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/HealthCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/HealthCheck.java index 8feb77a..b804f8b 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/checks/HealthCheck.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/HealthCheck.java @@ -76,7 +76,7 @@ public class HealthCheck extends AbstractCheckDescriptor { final Cluster cluster = clustersProvider.get().getCluster(clusterName); List<AlertCurrentEntity> alerts = alertsDAO.findCurrentByCluster(cluster.getClusterId()); - List<String> errorMessages = new ArrayList<String>(); + List<String> errorMessages = new ArrayList<>(); for (AlertCurrentEntity alert : alerts) { AlertHistoryEntity alertHistory = alert.getAlertHistory(); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheck.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheck.java index 1dd4159..ed7a49a 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheck.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheck.java @@ -69,7 +69,7 @@ public class HiveDynamicServiceDiscoveryCheck extends AbstractCheckDescriptor { */ @Override public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException { - List<String> errorMessages = new ArrayList<String>(); + List<String> errorMessages = new ArrayList<>(); String dynamicServiceDiscoveryEnabled = getProperty(request, "hive-site", "hive.server2.support.dynamic.service.discovery"); String zookeeperQuorum = getProperty(request, "hive-site", "hive.zookeeper.quorum"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheck.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheck.java index 01bf6ae..1e87319 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheck.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheck.java @@ -67,7 +67,7 @@ public class HostsMasterMaintenanceCheck extends AbstractCheckDescriptor { final String clusterName = request.getClusterName(); final Cluster cluster = clustersProvider.get().getCluster(clusterName); final StackId stackId = cluster.getDesiredStackVersion(); - final Set<String> hostsWithMasterComponent = new HashSet<String>(); + final Set<String> hostsWithMasterComponent = new HashSet<>(); // TODO AMBARI-12698, need to pass the upgrade pack to use in the request, or at least the type. final String upgradePackName = repositoryVersionHelper.get().getUpgradePackageName(stackId.getStackName(), stackId.getStackVersion(), request.getRepositoryVersion(), null); @@ -84,7 +84,7 @@ public class HostsMasterMaintenanceCheck extends AbstractCheckDescriptor { prerequisiteCheck.setFailReason(String.format(fail, upgradePackName)); return; } - final Set<String> componentsFromUpgradePack = new HashSet<String>(); + final Set<String> componentsFromUpgradePack = new HashSet<>(); for (Map<String, ProcessingComponent> task: upgradePack.getTasks().values()) { componentsFromUpgradePack.addAll(task.keySet()); } http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/checks/InstallPackagesCheck.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/InstallPackagesCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/InstallPackagesCheck.java index 38bdda2..2c20762 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/checks/InstallPackagesCheck.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/InstallPackagesCheck.java @@ -77,7 +77,7 @@ public class InstallPackagesCheck extends AbstractCheckDescriptor { final ClusterVersionEntity clusterVersion = clusterVersionDAOProvider.get().findByClusterAndStackAndVersion( clusterName, targetStackId, repoVersion); - final Set<String> failedHosts = new HashSet<String>(); + final Set<String> failedHosts = new HashSet<>(); for (Host host : cluster.getHosts()) { if (host.getMaintenanceState(cluster.getClusterId()) != MaintenanceState.ON) { @@ -95,7 +95,7 @@ public class InstallPackagesCheck extends AbstractCheckDescriptor { "Install Packages had failed. Please re-run Install Packages, if necessary place following hosts " + "in Maintenance mode: {4}", cluster.getClusterName(), targetStackId.getStackName(), targetStackId.getStackVersion(), repoVersion, StringUtils.join(failedHosts, ", ")); - prerequisiteCheck.setFailedOn(new LinkedHashSet<String>(failedHosts)); + prerequisiteCheck.setFailedOn(new LinkedHashSet<>(failedHosts)); prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL); prerequisiteCheck.setFailReason(message); } else if (clusterVersion.getState() == RepositoryVersionState.INSTALL_FAILED) { @@ -103,7 +103,7 @@ public class InstallPackagesCheck extends AbstractCheckDescriptor { "Install Packages failed. Please re-run Install Packages even if you placed the failed hosts " + "in Maintenance mode.", cluster.getClusterName(), targetStackId.getStackName(), targetStackId.getStackVersion(), repoVersion); - LinkedHashSet<String> failedOn = new LinkedHashSet<String>(); + LinkedHashSet<String> failedOn = new LinkedHashSet<>(); failedOn.add(cluster.getClusterName()); prerequisiteCheck.setFailedOn(failedOn); prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheck.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheck.java index 31e3df8..8ab3c11 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheck.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheck.java @@ -66,7 +66,7 @@ public class MapReduce2JobHistoryStatePreservingCheck extends AbstractCheckDescr */ @Override public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException { - List<String> errorMessages = new ArrayList<String>(); + List<String> errorMessages = new ArrayList<>(); PrereqCheckStatus checkStatus = PrereqCheckStatus.FAIL; String enabled = http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/checks/PreviousUpgradeCompleted.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/PreviousUpgradeCompleted.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/PreviousUpgradeCompleted.java index fe57ae4..ef165a5 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/checks/PreviousUpgradeCompleted.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/PreviousUpgradeCompleted.java @@ -71,7 +71,7 @@ public class PreviousUpgradeCompleted extends AbstractCheckDescriptor { } if (null != errorMessage) { - LinkedHashSet<String> failedOn = new LinkedHashSet<String>(); + LinkedHashSet<String> failedOn = new LinkedHashSet<>(); failedOn.add(cluster.getClusterName()); prerequisiteCheck.setFailedOn(failedOn); prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheck.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheck.java index ea2e028..543df26 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheck.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/SecondaryNamenodeDeletedCheck.java @@ -74,7 +74,7 @@ public class SecondaryNamenodeDeletedCheck extends AbstractCheckDescriptor { // given the type of upgrade. The PrereqCheckRequest object has a field for the type of upgrade. @Override public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException { - Set<String> hosts = new HashSet<String>(); + Set<String> hosts = new HashSet<>(); final String SECONDARY_NAMENODE = "SECONDARY_NAMENODE"; final String clusterName = request.getClusterName(); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicePresenceCheck.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicePresenceCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicePresenceCheck.java index 4642b88..ed38882 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicePresenceCheck.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicePresenceCheck.java @@ -123,7 +123,7 @@ public class ServicePresenceCheck extends AbstractCheckDescriptor{ * @return service names * */ private List<String> getNoUpgradeSupportServices(PrereqCheckRequest request){ - List<String> result = new ArrayList<String>(); + List<String> result = new ArrayList<>(); String value = getPropertyValue(request, NO_UPGRADE_SUPPORT_SERVICES_PROPERTY_NAME); if (null != value){ String[] services = value.split(","); @@ -141,7 +141,7 @@ public class ServicePresenceCheck extends AbstractCheckDescriptor{ * @return service names and new service names map * */ private Map<String, String> getRemovedServices(PrereqCheckRequest request) throws AmbariException{ - Map<String, String> result = new LinkedHashMap<String, String>(); + Map<String, String> result = new LinkedHashMap<>(); String value = getPropertyValue(request, REMOVED_SERVICES_PROPERTY_NAME); String newValue = getPropertyValue(request, NEW_SERVICES_PROPERTY_NAME); if(value == null && newValue == null){ http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheck.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheck.java index 3bd4f1a..3fd55b7 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheck.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheck.java @@ -96,7 +96,7 @@ public class ServicesMapReduceDistributedCacheCheck extends AbstractCheckDescrip final String frameworkPath = mrConfig.getProperties().get("mapreduce.application.framework.path"); final String defaultFS = coreSiteConfig.getProperties().get("fs.defaultFS"); - List<String> errorMessages = new ArrayList<String>(); + List<String> errorMessages = new ArrayList<>(); if (applicationClasspath == null || applicationClasspath.isEmpty()) { errorMessages.add(getFailReason(KEY_APP_CLASSPATH, prerequisiteCheck, request)); } http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheck.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheck.java index 4b2e796..a564957 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheck.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheck.java @@ -96,7 +96,7 @@ public class ServicesTezDistributedCacheCheck extends AbstractCheckDescriptor { final String useHadoopLibs = tezConfig.getProperties().get("tez.use.cluster.hadoop-libs"); final String defaultFS = coreSiteConfig.getProperties().get("fs.defaultFS"); - List<String> errorMessages = new ArrayList<String>(); + List<String> errorMessages = new ArrayList<>(); if (libUris == null || libUris.isEmpty()) { errorMessages.add(getFailReason(KEY_LIB_URI_MISSING, prerequisiteCheck, request)); } http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesUpCheck.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesUpCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesUpCheck.java index d838f6a..05f3e91 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesUpCheck.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicesUpCheck.java @@ -88,8 +88,8 @@ public class ServicesUpCheck extends AbstractCheckDescriptor { final String clusterName = request.getClusterName(); final Cluster cluster = clustersProvider.get().getCluster(clusterName); - List<String> errorMessages = new ArrayList<String>(); - Set<String> failedServiceNames = new HashSet<String>(); + List<String> errorMessages = new ArrayList<>(); + Set<String> failedServiceNames = new HashSet<>(); StackId stackId = cluster.getCurrentStackVersion(); @@ -182,7 +182,7 @@ public class ServicesUpCheck extends AbstractCheckDescriptor { } if (!errorMessages.isEmpty()) { - prerequisiteCheck.setFailedOn(new LinkedHashSet<String>(failedServiceNames)); + prerequisiteCheck.setFailedOn(new LinkedHashSet<>(failedServiceNames)); prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL); prerequisiteCheck.setFailReason( "The following Service Components should be in a started state. Please invoke a service Stop and full Start and try again. " http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/checks/UpgradeCheckRegistry.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/UpgradeCheckRegistry.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/UpgradeCheckRegistry.java index f4e67fd..1216a9e 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/checks/UpgradeCheckRegistry.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/UpgradeCheckRegistry.java @@ -48,8 +48,8 @@ public class UpgradeCheckRegistry { /** * The list of upgrade checks to run through. */ - private Set<AbstractCheckDescriptor> m_upgradeChecks = new TreeSet<AbstractCheckDescriptor>( - new PreUpgradeCheckComparator()); + private Set<AbstractCheckDescriptor> m_upgradeChecks = new TreeSet<>( + new PreUpgradeCheckComparator()); /** * Register an upgrade check. @@ -67,12 +67,12 @@ public class UpgradeCheckRegistry { * @return */ public List<AbstractCheckDescriptor> getUpgradeChecks() { - return new ArrayList<AbstractCheckDescriptor>(m_upgradeChecks); + return new ArrayList<>(m_upgradeChecks); } public List<AbstractCheckDescriptor> getServiceLevelUpgradeChecks(UpgradePack upgradePack, Map<String, ServiceInfo> services) { List<String> prerequisiteChecks = upgradePack.getPrerequisiteChecks(); - List<String> missingChecks = new ArrayList<String>(); + List<String> missingChecks = new ArrayList<>(); for (String prerequisiteCheck : prerequisiteChecks) { if (!isRegistered(prerequisiteCheck)) { missingChecks.add(prerequisiteCheck); @@ -84,7 +84,7 @@ public class UpgradeCheckRegistry { return checks; } - List<URL> urls = new ArrayList<URL>(); + List<URL> urls = new ArrayList<>(); for (ServiceInfo service : services.values()) { File dir = service.getChecksFolder(); File[] jars = dir.listFiles(new FilenameFilter() { @@ -142,7 +142,7 @@ public class UpgradeCheckRegistry { */ public List<AbstractCheckDescriptor> getFilteredUpgradeChecks(UpgradePack upgradePack){ List<String> prerequisiteChecks = upgradePack.getPrerequisiteChecks(); - List<AbstractCheckDescriptor> resultCheckDescriptor = new ArrayList<AbstractCheckDescriptor>(); + List<AbstractCheckDescriptor> resultCheckDescriptor = new ArrayList<>(); for (AbstractCheckDescriptor descriptor: m_upgradeChecks){ if (descriptor.isRequired(upgradePack.getType())) { resultCheckDescriptor.add(descriptor); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/checks/VersionMismatchCheck.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/VersionMismatchCheck.java b/ambari-server/src/main/java/org/apache/ambari/server/checks/VersionMismatchCheck.java index 3dc320b..2a3ec19 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/checks/VersionMismatchCheck.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/VersionMismatchCheck.java @@ -55,7 +55,7 @@ public class VersionMismatchCheck extends AbstractCheckDescriptor { final String clusterName = request.getClusterName(); final Cluster cluster = clustersProvider.get().getCluster(clusterName); Map<String, Service> services = cluster.getServices(); - List<String> errorMessages = new ArrayList<String>(); + List<String> errorMessages = new ArrayList<>(); for (Service service : services.values()) { validateService(service, prerequisiteCheck, errorMessages); } http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/collections/functors/ContainsPredicate.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/collections/functors/ContainsPredicate.java b/ambari-server/src/main/java/org/apache/ambari/server/collections/functors/ContainsPredicate.java index a0f18f8..0f867db 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/collections/functors/ContainsPredicate.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/collections/functors/ContainsPredicate.java @@ -113,7 +113,7 @@ public class ContainsPredicate extends OperationPredicate { @Override public Map<String, Object> toMap() { return Collections.<String, Object>singletonMap(NAME, - new ArrayList<String>(Arrays.asList(getContextKey(), value))); + new ArrayList<>(Arrays.asList(getContextKey(), value))); } @Override http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/collections/functors/DelegatedMultiplePredicateContainer.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/collections/functors/DelegatedMultiplePredicateContainer.java b/ambari-server/src/main/java/org/apache/ambari/server/collections/functors/DelegatedMultiplePredicateContainer.java index dff2403..b48337e 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/collections/functors/DelegatedMultiplePredicateContainer.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/collections/functors/DelegatedMultiplePredicateContainer.java @@ -92,7 +92,7 @@ abstract class DelegatedMultiplePredicateContainer extends Predicate implements */ private List<Map<String, Object>> containedPredicatesToMaps() { - List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); + List<Map<String, Object>> list = new ArrayList<>(); if (delegate != null) { org.apache.commons.collections.Predicate[] predicates = delegate.getPredicates(); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/collections/functors/EqualsPredicate.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/collections/functors/EqualsPredicate.java b/ambari-server/src/main/java/org/apache/ambari/server/collections/functors/EqualsPredicate.java index 2bbb672..36efe17 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/collections/functors/EqualsPredicate.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/collections/functors/EqualsPredicate.java @@ -104,7 +104,7 @@ public class EqualsPredicate extends OperationPredicate { @Override public Map<String, Object> toMap() { return Collections.<String, Object>singletonMap(NAME, - new ArrayList<String>(Arrays.asList(getContextKey(), delegate.getValue().toString()))); + new ArrayList<>(Arrays.asList(getContextKey(), delegate.getValue().toString()))); } @Override http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/collections/functors/PredicateClassFactory.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/collections/functors/PredicateClassFactory.java b/ambari-server/src/main/java/org/apache/ambari/server/collections/functors/PredicateClassFactory.java index 2ef64d7..c4bfaf0 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/collections/functors/PredicateClassFactory.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/collections/functors/PredicateClassFactory.java @@ -35,7 +35,7 @@ public class PredicateClassFactory { private static final Map<String, Class<? extends Predicate>> NAME_TO_CLASS; static { - Map<String, Class<? extends Predicate>> map = new HashMap<String, Class<? extends Predicate>>(); + Map<String, Class<? extends Predicate>> map = new HashMap<>(); map.put(AndPredicate.NAME, AndPredicate.class); map.put(OrPredicate.NAME, OrPredicate.class); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariHandlerList.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariHandlerList.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariHandlerList.java index 5268b12..4d4c8cc 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariHandlerList.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariHandlerList.java @@ -104,12 +104,12 @@ public class AmbariHandlerList extends HandlerCollection implements ViewInstance /** * Mapping of view instance entities to handlers. */ - private final Map<ViewInstanceEntity, Handler> viewHandlerMap = new HashMap<ViewInstanceEntity, Handler>(); + private final Map<ViewInstanceEntity, Handler> viewHandlerMap = new HashMap<>(); /** * The non-view handlers. */ - private final Collection<Handler> nonViewHandlers = new HashSet<Handler>(); + private final Collection<Handler> nonViewHandlers = new HashSet<>(); /** * The logger. http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/controller/AuthToLocalBuilder.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AuthToLocalBuilder.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AuthToLocalBuilder.java index 8c70a47..33c8f3b 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AuthToLocalBuilder.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AuthToLocalBuilder.java @@ -60,7 +60,7 @@ public class AuthToLocalBuilder implements Cloneable { /** * Ordered set of rules which have been added to the builder. */ - private Set<Rule> setRules = new TreeSet<Rule>(); + private Set<Rule> setRules = new TreeSet<>(); /** * The default realm. @@ -105,7 +105,7 @@ public class AuthToLocalBuilder implements Cloneable { this.additionalRealms = (additionalRealms == null) ? Collections.<String>emptySet() - : Collections.unmodifiableSet(new HashSet<String>(additionalRealms)); + : Collections.unmodifiableSet(new HashSet<>(additionalRealms)); this.caseInsensitiveUser = caseInsensitiveUserSupport; } @@ -115,7 +115,7 @@ public class AuthToLocalBuilder implements Cloneable { AuthToLocalBuilder copy = (AuthToLocalBuilder) super.clone(); /* **** Copy mutable members **** */ - copy.setRules = new TreeSet<Rule>(setRules); + copy.setRules = new TreeSet<>(setRules); return copy; } @@ -301,7 +301,7 @@ public class AuthToLocalBuilder implements Cloneable { Collection<String> collection = null; if (!StringUtils.isEmpty(string)) { - collection = new HashSet<String>(); + collection = new HashSet<>(); for (String realm : string.split("\\s*(?:\\r?\\n|,)\\s*")) { realm = realm.trim(); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java index 0e28a86..38c14c5 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java @@ -38,8 +38,8 @@ public class ConfigurationRequest { private boolean includeProperties; public ConfigurationRequest() { - configs = new HashMap<String, String>(); - configsAttributes = new HashMap<String, Map<String,String>>(); + configs = new HashMap<>(); + configsAttributes = new HashMap<>(); } public ConfigurationRequest(String clusterName, http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/controller/ExecuteActionRequest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ExecuteActionRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ExecuteActionRequest.java index ae7020a..351974a 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ExecuteActionRequest.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ExecuteActionRequest.java @@ -61,11 +61,11 @@ public class ExecuteActionRequest { this.clusterName = clusterName; this.commandName = commandName; this.actionName = null; - this.parameters = new HashMap<String, String>(); + this.parameters = new HashMap<>(); if (parameters != null) { this.parameters.putAll(parameters); } - this.resourceFilters = new ArrayList<RequestResourceFilter>(); + this.resourceFilters = new ArrayList<>(); this.exclusive = exclusive; } http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/controller/ExtensionLinkResponse.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ExtensionLinkResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ExtensionLinkResponse.java index 10e0383..99c9ce9 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ExtensionLinkResponse.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ExtensionLinkResponse.java @@ -43,7 +43,7 @@ public class ExtensionLinkResponse implements Validable { private boolean valid; - private Set<String> errorSet = new HashSet<String>(); + private Set<String> errorSet = new HashSet<>(); public ExtensionLinkResponse(String linkId, String stackName, String stackVersion, String extensionName, String extensionVersion, boolean valid, Collection<String> errorSet) { http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/controller/ExtensionVersionResponse.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ExtensionVersionResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ExtensionVersionResponse.java index 986acc6..7875663 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ExtensionVersionResponse.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ExtensionVersionResponse.java @@ -54,7 +54,7 @@ public class ExtensionVersionResponse implements Validable{ this.valid = valid; } - private Set<String> errorSet = new HashSet<String>(); + private Set<String> errorSet = new HashSet<>(); @Override public void addError(String error) {