You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ad...@apache.org on 2017/03/29 12:43:18 UTC
[22/32] ambari git commit: AMBARI-19149. Code cleanup: redundant type
arguments
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/GroupDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/GroupDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/GroupDAO.java
index 8b5902c..638a442 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/GroupDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/GroupDAO.java
@@ -117,7 +117,7 @@ public class GroupDAO {
@Transactional
public void create(GroupEntity group) {
- create(new HashSet<GroupEntity>(Arrays.asList(group)));
+ create(new HashSet<>(Arrays.asList(group)));
}
@Transactional
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostConfigMappingDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostConfigMappingDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostConfigMappingDAO.java
index 0b6c14a..410f5cf 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostConfigMappingDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostConfigMappingDAO.java
@@ -68,7 +68,7 @@ public class HostConfigMappingDAO {
if (!cacheLoaded) {
if (hostConfigMappingByHost == null) {
- hostConfigMappingByHost = new ConcurrentHashMap<Long, Set<HostConfigMapping>>();
+ hostConfigMappingByHost = new ConcurrentHashMap<>();
TypedQuery<HostConfigMappingEntity> query = entityManagerProvider.get().createNamedQuery(
"HostConfigMappingEntity.findAll", HostConfigMappingEntity.class);
@@ -86,7 +86,7 @@ public class HostConfigMappingDAO {
if (hostConfigMappingByHost.containsKey(hostId)) {
setByHost = hostConfigMappingByHost.get(hostId);
} else {
- setByHost = new HashSet<HostConfigMapping>();
+ setByHost = new HashSet<>();
hostConfigMappingByHost.put(hostId, setByHost);
}
@@ -115,7 +115,7 @@ public class HostConfigMappingDAO {
if (hostConfigMappingByHost.containsKey(hostId)) {
set = hostConfigMappingByHost.get(hostId);
} else {
- set = new HashSet<HostConfigMapping>();
+ set = new HashSet<>();
hostConfigMappingByHost.put(hostId, set);
}
@@ -133,7 +133,7 @@ public class HostConfigMappingDAO {
if (hostConfigMappingByHost.containsKey(hostId)) {
set = hostConfigMappingByHost.get(hostId);
} else {
- set = new HashSet<HostConfigMapping>();
+ set = new HashSet<>();
hostConfigMappingByHost.put(hostId, set);
}
@@ -154,7 +154,7 @@ public class HostConfigMappingDAO {
if (!hostConfigMappingByHost.containsKey(hostId))
return Collections.emptySet();
- Set<HostConfigMapping> set = new HashSet<HostConfigMapping>(hostConfigMappingByHost.get(hostId));
+ Set<HostConfigMapping> set = new HashSet<>(hostConfigMappingByHost.get(hostId));
CollectionUtils.filter(set, new Predicate() {
@@ -176,7 +176,7 @@ public class HostConfigMappingDAO {
if (!hostConfigMappingByHost.containsKey(hostId))
return null;
- Set<HostConfigMapping> set = new HashSet<HostConfigMapping>(hostConfigMappingByHost.get(hostId));
+ Set<HostConfigMapping> set = new HashSet<>(hostConfigMappingByHost.get(hostId));
HostConfigMapping result = (HostConfigMapping) CollectionUtils.find(set, new Predicate() {
@@ -198,7 +198,7 @@ public class HostConfigMappingDAO {
if (!hostConfigMappingByHost.containsKey(hostId))
return Collections.emptySet();
- Set<HostConfigMapping> set = new HashSet<HostConfigMapping>(hostConfigMappingByHost.get(hostId));
+ Set<HostConfigMapping> set = new HashSet<>(hostConfigMappingByHost.get(hostId));
CollectionUtils.filter(set, new Predicate() {
@@ -220,13 +220,13 @@ public class HostConfigMappingDAO {
return Collections.emptySet();
}
- HashSet<HostConfigMapping> result = new HashSet<HostConfigMapping>();
+ HashSet<HostConfigMapping> result = new HashSet<>();
for (final Long hostId : hostIds) {
if (!hostConfigMappingByHost.containsKey(hostId))
continue;
- Set<HostConfigMapping> set = new HashSet<HostConfigMapping>(hostConfigMappingByHost.get(hostId));
+ Set<HostConfigMapping> set = new HashSet<>(hostConfigMappingByHost.get(hostId));
CollectionUtils.filter(set, new Predicate() {
@@ -249,7 +249,7 @@ public class HostConfigMappingDAO {
Collection<String> types) {
populateCache();
- Map<String, List<HostConfigMapping>> mappingsByType = new HashMap<String, List<HostConfigMapping>>();
+ Map<String, List<HostConfigMapping>> mappingsByType = new HashMap<>();
for (String type : types) {
if (!mappingsByType.containsKey(type)) {
@@ -258,7 +258,7 @@ public class HostConfigMappingDAO {
}
if (!types.isEmpty()) {
- List<HostConfigMapping> mappings = new ArrayList<HostConfigMapping>();
+ List<HostConfigMapping> mappings = new ArrayList<>();
for (Set<HostConfigMapping> entries : hostConfigMappingByHost.values()) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostDAO.java
index 0d20fd3..f355b60 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostDAO.java
@@ -116,7 +116,7 @@ public class HostDAO {
}
public List<String> getHostNamesByHostIds(List<Long> hostIds) {
- List<String> hostNames = new ArrayList<String>();
+ List<String> hostNames = new ArrayList<>();
if (hostIds != null) {
for (Long hostId : hostIds) {
HostEntity hostEntity = findById(hostId);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java
index e834045..79b8bc9 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java
@@ -236,7 +236,7 @@ public class HostRoleCommandDAO {
*/
@RequiresSession
private Map<Long, HostRoleCommandStatusSummaryDTO> loadAggregateCounts(Long requestId) {
- Map<Long, HostRoleCommandStatusSummaryDTO> map = new HashMap<Long, HostRoleCommandStatusSummaryDTO>();
+ Map<Long, HostRoleCommandStatusSummaryDTO> map = new HashMap<>();
EntityManager entityManager = entityManagerProvider.get();
TypedQuery<HostRoleCommandStatusSummaryDTO> query = entityManager.createQuery(SUMMARY_DTO,
@@ -294,9 +294,9 @@ public class HostRoleCommandDAO {
HostRoleCommandEntity.class);
if (taskIds.size() > configuration.getTaskIdListLimit()) {
- List<HostRoleCommandEntity> result = new ArrayList<HostRoleCommandEntity>();
+ List<HostRoleCommandEntity> result = new ArrayList<>();
- List<List<Long>> lists = Lists.partition(new ArrayList<Long>(taskIds), configuration.getTaskIdListLimit());
+ List<List<Long>> lists = Lists.partition(new ArrayList<>(taskIds), configuration.getTaskIdListLimit());
for (List<Long> list : lists) {
result.addAll(daoUtils.selectList(query, list));
}
@@ -364,9 +364,9 @@ public class HostRoleCommandDAO {
);
if (taskIds.size() > configuration.getTaskIdListLimit()) {
- List<Long> result = new ArrayList<Long>();
+ List<Long> result = new ArrayList<>();
- List<List<Long>> lists = Lists.partition(new ArrayList<Long>(taskIds), configuration.getTaskIdListLimit());
+ List<List<Long>> lists = Lists.partition(new ArrayList<>(taskIds), configuration.getTaskIdListLimit());
for (List<Long> taskIdList : lists) {
result.addAll(daoUtils.selectList(query, requestIds, taskIdList));
}
@@ -424,7 +424,7 @@ public class HostRoleCommandDAO {
"ORDER BY hostRoleCommand.hostEntity.hostName, hostRoleCommand.taskId", HostRoleCommandEntity.class);
List<HostRoleCommandEntity> commandEntities = daoUtils.selectList(query, stageEntity);
- Map<String, List<HostRoleCommandEntity>> hostCommands = new HashMap<String, List<HostRoleCommandEntity>>();
+ Map<String, List<HostRoleCommandEntity>> hostCommands = new HashMap<>();
for (HostRoleCommandEntity commandEntity : commandEntities) {
if (!hostCommands.containsKey(commandEntity.getHostName())) {
@@ -669,7 +669,7 @@ public class HostRoleCommandDAO {
@TransactionalLock(lockArea = LockArea.HRC_STATUS_CACHE, lockType = LockType.WRITE)
public List<HostRoleCommandEntity> mergeAll(Collection<HostRoleCommandEntity> entities) {
Set<Long> requestsToInvalidate = new LinkedHashSet<>();
- List<HostRoleCommandEntity> managedList = new ArrayList<HostRoleCommandEntity>(entities.size());
+ List<HostRoleCommandEntity> managedList = new ArrayList<>(entities.size());
for (HostRoleCommandEntity entity : entities) {
EntityManager entityManager = entityManagerProvider.get();
entity = entityManager.merge(entity);
@@ -896,7 +896,7 @@ public class HostRoleCommandDAO {
// sorting
SortRequest sortRequest = request.getSortRequest();
if (null != sortRequest) {
- JpaSortBuilder<HostRoleCommandEntity> sortBuilder = new JpaSortBuilder<HostRoleCommandEntity>();
+ JpaSortBuilder<HostRoleCommandEntity> sortBuilder = new JpaSortBuilder<>();
List<Order> sortOrders = sortBuilder.buildSortOrders(sortRequest, visitor);
query.orderBy(sortOrders);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandStatusSummaryDTO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandStatusSummaryDTO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandStatusSummaryDTO.java
index 549cc96..fcb8de4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandStatusSummaryDTO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandStatusSummaryDTO.java
@@ -33,8 +33,8 @@ public class HostRoleCommandStatusSummaryDTO {
private Long m_minTime = Long.valueOf(0L);
private Long m_maxTime = Long.valueOf(Long.MAX_VALUE);
private boolean m_skippable = false;
- private Map<HostRoleStatus, Integer> m_counts = new HashMap<HostRoleStatus, Integer>();
- private List<HostRoleStatus> m_tasksStatus = new ArrayList<HostRoleStatus>();
+ private Map<HostRoleStatus, Integer> m_counts = new HashMap<>();
+ private List<HostRoleStatus> m_tasksStatus = new ArrayList<>();
/**
* Constructor invoked by JPA. See {{@link HostRoleCommandDAO#findAggregateCounts(Long)}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/MemberDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/MemberDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/MemberDAO.java
index 15b2995..c146f9f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/MemberDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/MemberDAO.java
@@ -74,7 +74,7 @@ public class MemberDAO {
@Transactional
public void create(MemberEntity member) {
- create(new HashSet<MemberEntity>(Arrays.asList(member)));
+ create(new HashSet<>(Arrays.asList(member)));
}
@Transactional
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java
index 212a9f0..49ad682 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java
@@ -88,7 +88,7 @@ public class ServiceConfigDAO {
cq.where(groupVersion.get("groupId").in(configGroupIds));
cq.groupBy(groupVersion.get("groupId"));
List<Tuple> tuples = daoUtils.selectList(entityManagerProvider.get().createQuery(cq));
- List<ServiceConfigEntity> result = new ArrayList<ServiceConfigEntity>();
+ List<ServiceConfigEntity> result = new ArrayList<>();
//subquery look to be very poor, no bulk select then, cache should help here as result size is naturally limited
for (Tuple tuple : tuples) {
CriteriaQuery<ServiceConfigEntity> sce = cb.createQuery(ServiceConfigEntity.class);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/StageDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/StageDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/StageDAO.java
index 126468a..5151fb3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/StageDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/StageDAO.java
@@ -61,7 +61,7 @@ public class StageDAO {
/**
* Mapping of valid status transitions that that are driven by manual input.
*/
- private static Map<HostRoleStatus, EnumSet<HostRoleStatus>> manualTransitionMap = new HashMap<HostRoleStatus, EnumSet<HostRoleStatus>>();
+ private static Map<HostRoleStatus, EnumSet<HostRoleStatus>> manualTransitionMap = new HashMap<>();
static {
manualTransitionMap.put(HostRoleStatus.HOLDING,
@@ -154,7 +154,7 @@ public class StageDAO {
*/
@RequiresSession
public List<StageEntity> findByStageIds(Long requestId, Set<Long> stageIds) {
- List<StageEntity> stageEntities = new LinkedList<StageEntity>();
+ List<StageEntity> stageEntities = new LinkedList<>();
for (StageEntity stage : findByRequestId(requestId)) {
if (stageIds.contains(stage.getStageId())) {
@@ -190,7 +190,7 @@ public class StageDAO {
@RequiresSession
public Map<Long, String> findRequestContext(List<Long> requestIds) {
- Map<Long, String> resultMap = new HashMap<Long, String>();
+ Map<Long, String> resultMap = new HashMap<>();
if (requestIds != null && !requestIds.isEmpty()) {
TypedQuery<StageEntity> query = entityManagerProvider.get()
.createQuery("SELECT stage FROM StageEntity stage WHERE " +
@@ -264,7 +264,7 @@ public class StageDAO {
}
// sorting
- JpaSortBuilder<StageEntity> sortBuilder = new JpaSortBuilder<StageEntity>();
+ JpaSortBuilder<StageEntity> sortBuilder = new JpaSortBuilder<>();
List<Order> sortOrders = sortBuilder.buildSortOrders(request.getSortRequest(), visitor);
query.orderBy(sortOrders);
@@ -306,7 +306,7 @@ public class StageDAO {
if (desiredStatus == HostRoleStatus.ABORTED) {
actionManager.cancelRequest(stage.getRequestId(), "User aborted.");
} else {
- List <HostRoleCommandEntity> hrcWithChangedStatus = new ArrayList<HostRoleCommandEntity>();
+ List <HostRoleCommandEntity> hrcWithChangedStatus = new ArrayList<>();
for (HostRoleCommandEntity hostRoleCommand : tasks) {
HostRoleStatus hostRoleStatus = hostRoleCommand.getStatus();
if (hostRoleStatus.equals(currentStatus)) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/UserDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/UserDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/UserDAO.java
index 60f6fd5..246e515 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/UserDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/UserDAO.java
@@ -95,7 +95,7 @@ public class UserDAO {
case 1:
return resultList.get(0);
default:
- ImmutableMap.Builder<UserType, UserEntity> mapBuilder = ImmutableMap.<UserType, UserEntity>builder();
+ ImmutableMap.Builder<UserType, UserEntity> mapBuilder = ImmutableMap.builder();
for (UserEntity user: resultList) {
mapBuilder.put(user.getUserType(), user);
}
@@ -182,7 +182,7 @@ public class UserDAO {
@Transactional
public void create(UserEntity user) {
- create(new HashSet<UserEntity>(Arrays.asList(user)));
+ create(new HashSet<>(Arrays.asList(user)));
}
@Transactional
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertCurrentEntity_.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertCurrentEntity_.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertCurrentEntity_.java
index 52c27df..d09d906 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertCurrentEntity_.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertCurrentEntity_.java
@@ -63,7 +63,7 @@ public class AlertCurrentEntity_ {
*/
@SuppressWarnings("unchecked")
public static Map<String, List<? extends SingularAttribute<?, ?>>> getPredicateMapping() {
- Map<String, List<? extends SingularAttribute<?, ?>>> mapping = new HashMap<String, List<? extends SingularAttribute<?, ?>>>();
+ Map<String, List<? extends SingularAttribute<?, ?>>> mapping = new HashMap<>();
mapping.put(AlertResourceProvider.ALERT_ID,
Collections.singletonList(alertId));
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertDefinitionEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertDefinitionEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertDefinitionEntity.java
index 0eebf4b..6337487 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertDefinitionEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertDefinitionEntity.java
@@ -555,7 +555,7 @@ public class AlertDefinitionEntity {
*/
protected void addAlertGroup(AlertGroupEntity alertGroup) {
if (null == alertGroups) {
- alertGroups = new HashSet<AlertGroupEntity>();
+ alertGroups = new HashSet<>();
}
alertGroups.add(alertGroup);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertHistoryEntity_.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertHistoryEntity_.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertHistoryEntity_.java
index c6f5e6a..c8c764e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertHistoryEntity_.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertHistoryEntity_.java
@@ -67,7 +67,7 @@ public class AlertHistoryEntity_ {
*/
@SuppressWarnings("unchecked")
public static Map<String, List<? extends SingularAttribute<?, ?>>> getPredicateMapping() {
- Map<String, List<? extends SingularAttribute<?, ?>>> mapping = new HashMap<String, List<? extends SingularAttribute<?, ?>>>();
+ Map<String, List<? extends SingularAttribute<?, ?>>> mapping = new HashMap<>();
mapping.put(AlertHistoryResourceProvider.ALERT_HISTORY_ID,
Collections.singletonList(alertId));
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertNoticeEntity_.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertNoticeEntity_.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertNoticeEntity_.java
index 64a11c2..70ea3ab 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertNoticeEntity_.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertNoticeEntity_.java
@@ -61,7 +61,7 @@ public class AlertNoticeEntity_ {
*/
@SuppressWarnings("unchecked")
public static Map<String, List<? extends SingularAttribute<?, ?>>> getPredicateMapping() {
- Map<String, List<? extends SingularAttribute<?, ?>>> mapping = new HashMap<String, List<? extends SingularAttribute<?, ?>>>();
+ Map<String, List<? extends SingularAttribute<?, ?>>> mapping = new HashMap<>();
mapping.put(AlertNoticeResourceProvider.ALERT_NOTICE_ID,
Collections.singletonList(notificationId));
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertTargetEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertTargetEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertTargetEntity.java
index 7753b63..fd17b80 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertTargetEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/AlertTargetEntity.java
@@ -328,7 +328,7 @@ public class AlertTargetEntity {
*/
protected void addAlertGroup(AlertGroupEntity alertGroup) {
if (null == alertGroups) {
- alertGroups = new HashSet<AlertGroupEntity>();
+ alertGroups = new HashSet<>();
}
alertGroups.add(alertGroup);
@@ -356,7 +356,7 @@ public class AlertTargetEntity {
*/
protected void addAlertNotice(AlertNoticeEntity notice) {
if (null == alertNotices) {
- alertNotices = new ArrayList<AlertNoticeEntity>();
+ alertNotices = new ArrayList<>();
}
alertNotices.add(notice);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntity_.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntity_.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntity_.java
index 895528f..af05e19 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntity_.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntity_.java
@@ -73,7 +73,7 @@ public class HostRoleCommandEntity_ {
* @return
*/
public static Map<String, List<? extends SingularAttribute<?, ?>>> getPredicateMapping() {
- Map<String, List<? extends SingularAttribute<?, ?>>> mapping = new HashMap<String, List<? extends SingularAttribute<?, ?>>>();
+ Map<String, List<? extends SingularAttribute<?, ?>>> mapping = new HashMap<>();
mapping.put(TaskResourceProvider.TASK_ID_PROPERTY_ID,
Collections.singletonList(taskId));
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/OperatingSystemEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/OperatingSystemEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/OperatingSystemEntity.java
index f615da6..8fb32a1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/OperatingSystemEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/OperatingSystemEntity.java
@@ -26,7 +26,7 @@ import java.util.List;
public class OperatingSystemEntity {
private String osType;
- private List<RepositoryEntity> repositories = new ArrayList<RepositoryEntity>();
+ private List<RepositoryEntity> repositories = new ArrayList<>();
private boolean ambariManagedRepos = true;
public String getOsType() {
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/PrincipalEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/PrincipalEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/PrincipalEntity.java
index fc92a5f..d363fe6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/PrincipalEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/PrincipalEntity.java
@@ -67,7 +67,7 @@ public class PrincipalEntity {
private PrincipalTypeEntity principalType;
@OneToMany(mappedBy = "principal")
- private Set<PrivilegeEntity> privileges = new HashSet<PrivilegeEntity>();
+ private Set<PrivilegeEntity> privileges = new HashSet<>();
// ----- PrincipalEntity ---------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ResourceEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ResourceEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ResourceEntity.java
index 3dd96d7..53146b1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ResourceEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ResourceEntity.java
@@ -69,7 +69,7 @@ public class ResourceEntity {
* The list of privileges.
*/
@OneToMany(cascade = CascadeType.ALL, mappedBy = "resource")
- private Collection<PrivilegeEntity> privileges = new HashSet<PrivilegeEntity>();
+ private Collection<PrivilegeEntity> privileges = new HashSet<>();
// ----- ResourceEntity ---------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity_.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity_.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity_.java
index b63572b..dc39e55 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity_.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity_.java
@@ -60,7 +60,7 @@ public class StageEntity_ {
* @return a mapping of between a resource provider property
*/
public static Map<String, List<? extends SingularAttribute<StageEntity, ?>>> getPredicateMapping() {
- Map<String, List<? extends SingularAttribute<StageEntity, ?>>> mapping = new HashMap<String, List<? extends SingularAttribute<StageEntity, ?>>>();
+ Map<String, List<? extends SingularAttribute<StageEntity, ?>>> mapping = new HashMap<>();
mapping.put(StageResourceProvider.STAGE_REQUEST_ID,
Collections.singletonList(requestId));
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UserEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UserEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UserEntity.java
index caa68c1..576ca97 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UserEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/UserEntity.java
@@ -93,7 +93,7 @@ public class UserEntity {
private Integer active = 1;
@OneToMany(mappedBy = "user", cascade = CascadeType.ALL)
- private Set<MemberEntity> memberEntities = new HashSet<MemberEntity>();
+ private Set<MemberEntity> memberEntities = new HashSet<>();
@OneToOne
@JoinColumns({
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ViewEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ViewEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ViewEntity.java
index 264d3d3..6ccec36 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ViewEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ViewEntity.java
@@ -134,19 +134,19 @@ public class ViewEntity implements ViewDefinition {
* The list of view parameters.
*/
@OneToMany(cascade = CascadeType.ALL, mappedBy = "view")
- private Collection<ViewParameterEntity> parameters = new HashSet<ViewParameterEntity>();
+ private Collection<ViewParameterEntity> parameters = new HashSet<>();
/**
* The list of view resources.
*/
@OneToMany(cascade = CascadeType.ALL, mappedBy = "view")
- private Collection<ViewResourceEntity> resources = new HashSet<ViewResourceEntity>();
+ private Collection<ViewResourceEntity> resources = new HashSet<>();
/**
* The list of view instances.
*/
@OneToMany(cascade = CascadeType.ALL, mappedBy = "view")
- private Collection<ViewInstanceEntity> instances = new HashSet<ViewInstanceEntity>();
+ private Collection<ViewInstanceEntity> instances = new HashSet<>();
/**
* The list of view permissions.
@@ -155,7 +155,7 @@ public class ViewEntity implements ViewDefinition {
@JoinColumns({
@JoinColumn(name = "resource_type_id", referencedColumnName = "resource_type_id", nullable = false)
})
- private Collection<PermissionEntity> permissions = new HashSet<PermissionEntity>();
+ private Collection<PermissionEntity> permissions = new HashSet<>();
/**
* The resource type.
@@ -196,19 +196,19 @@ public class ViewEntity implements ViewDefinition {
* The mapping of resource type to resource provider.
*/
@Transient
- private final Map<Resource.Type, ResourceProvider> resourceProviders = new HashMap<Resource.Type, ResourceProvider>();
+ private final Map<Resource.Type, ResourceProvider> resourceProviders = new HashMap<>();
/**
* The mapping of resource type to resource definition.
*/
@Transient
- private final Map<Resource.Type, ViewSubResourceDefinition> resourceDefinitions = new HashMap<Resource.Type, ViewSubResourceDefinition>();
+ private final Map<Resource.Type, ViewSubResourceDefinition> resourceDefinitions = new HashMap<>();
/**
* The mapping of resource type to resource configuration.
*/
@Transient
- private final Map<Resource.Type, ResourceConfig> resourceConfigurations = new HashMap<Resource.Type, ResourceConfig>();
+ private final Map<Resource.Type, ResourceConfig> resourceConfigurations = new HashMap<>();
/**
* The name of the view shared across versions.
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ViewInstanceEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ViewInstanceEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ViewInstanceEntity.java
index a803277..95ec52d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ViewInstanceEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ViewInstanceEntity.java
@@ -185,19 +185,19 @@ public class ViewInstanceEntity implements ViewInstanceDefinition {
* The instance properties.
*/
@OneToMany(cascade = CascadeType.ALL, mappedBy = "viewInstance")
- private Collection<ViewInstancePropertyEntity> properties = new HashSet<ViewInstancePropertyEntity>();
+ private Collection<ViewInstancePropertyEntity> properties = new HashSet<>();
/**
* The instance data.
*/
@OneToMany(cascade = CascadeType.ALL, mappedBy = "viewInstance")
- private Collection<ViewInstanceDataEntity> data = new HashSet<ViewInstanceDataEntity>();
+ private Collection<ViewInstanceDataEntity> data = new HashSet<>();
/**
* The list of view entities.
*/
@OneToMany(cascade = CascadeType.ALL, mappedBy = "viewInstance")
- private Collection<ViewEntityEntity> entities = new HashSet<ViewEntityEntity>();
+ private Collection<ViewEntityEntity> entities = new HashSet<>();
@ManyToOne
@JoinColumn(name = "view_name", referencedColumnName = "view_name", nullable = false)
@@ -224,14 +224,14 @@ public class ViewInstanceEntity implements ViewInstanceDefinition {
* instance is added.
*/
@Transient
- private final Map<Resource.Type, ResourceProvider> resourceProviders = new HashMap<Resource.Type, ResourceProvider>();
+ private final Map<Resource.Type, ResourceProvider> resourceProviders = new HashMap<>();
/**
* The mapping of the resource plural name to service. Calculated when the
* instance is added.
*/
@Transient
- private final Map<String, Object> services = new HashMap<String, Object>();
+ private final Map<String, Object> services = new HashMap<>();
/**
* Helper class.
@@ -324,7 +324,7 @@ public class ViewInstanceEntity implements ViewInstanceDefinition {
@Override
public Map<String, String> getPropertyMap() {
- Map<String, String> propertyMap = new HashMap<String, String>();
+ Map<String, String> propertyMap = new HashMap<>();
for (ViewInstancePropertyEntity viewInstancePropertyEntity : getProperties()) {
propertyMap.put(viewInstancePropertyEntity.getName(), viewInstancePropertyEntity.getValue());
@@ -340,7 +340,7 @@ public class ViewInstanceEntity implements ViewInstanceDefinition {
@Override
public Map<String, String> getInstanceDataMap() {
- Map<String, String> applicationData = new HashMap<String, String>();
+ Map<String, String> applicationData = new HashMap<>();
String user = getCurrentUserName();
@@ -894,14 +894,14 @@ public class ViewInstanceEntity implements ViewInstanceDefinition {
public InstanceValidationResultImpl getValidationResult(ViewEntity viewEntity, Validator.ValidationContext context)
throws IllegalStateException {
- Map<String, ValidationResult> propertyResults = new HashMap<String, ValidationResult>();
+ Map<String, ValidationResult> propertyResults = new HashMap<>();
if (context.equals(Validator.ValidationContext.PRE_CREATE) ||
context.equals(Validator.ValidationContext.PRE_UPDATE)) {
// make sure that there is an instance property value defined
// for each required view parameter
- Set<String> requiredParameterNames = new HashSet<String>();
+ Set<String> requiredParameterNames = new HashSet<>();
for (ViewParameterEntity parameter : viewEntity.getParameters()) {
if (parameter.isRequired()) {
// Don't enforce 'required' validation for cluster config parameters since
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/orm/models/HostComponentSummary.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/models/HostComponentSummary.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/models/HostComponentSummary.java
index cdc06fe..be73cad 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/models/HostComponentSummary.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/models/HostComponentSummary.java
@@ -81,7 +81,7 @@ public class HostComponentSummary {
}
public static List<HostComponentSummary> getHostComponentSummaries(String serviceName, String componentName) {
- List<HostComponentSummary> hostComponentSummaries = new ArrayList<HostComponentSummary>();
+ List<HostComponentSummary> hostComponentSummaries = new ArrayList<>();
List<HostComponentStateEntity> hostComponentStates = hostComponentStateDao.findByServiceAndComponent(serviceName, componentName);
if (hostComponentStates != null) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/proxy/ProxyService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/proxy/ProxyService.java b/ambari-server/src/main/java/org/apache/ambari/server/proxy/ProxyService.java
index a407769..c98495c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/proxy/ProxyService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/proxy/ProxyService.java
@@ -129,7 +129,7 @@ public class ProxyService {
}
private Map<String, List<String>> getHeaderParamsToForward(HttpHeaders headers) {
- Map<String, List<String>> headerParamsToForward = new HashMap<String, List<String>>();
+ Map<String, List<String>> headerParamsToForward = new HashMap<>();
for (String paramName: headers.getRequestHeaders().keySet()) {
if (paramName.startsWith(AMBARI_PROXY_PREFIX)) {
headerParamsToForward.put(paramName.replaceAll(AMBARI_PROXY_PREFIX,""), headers.getRequestHeader(paramName));
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/security/SecurePasswordHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/SecurePasswordHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/security/SecurePasswordHelper.java
index 1b0b940..5849bdd 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/SecurePasswordHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/SecurePasswordHelper.java
@@ -146,7 +146,7 @@ public class SecurePasswordHelper {
}
// Gather the set of characters that meet the specified requirements
- List<Character> characters = new ArrayList<Character>(length);
+ List<Character> characters = new ArrayList<>(length);
for (int i = 0; i < minLowercaseLetters; i++) {
characters.add(SecurePasswordHelper.SECURE_PASSWORD_CHARACTER_CLASS_LOWERCASE_LETTERS[secureRandom.nextInt(SecurePasswordHelper.SECURE_PASSWORD_CHARACTER_CLASS_LOWERCASE_LETTERS.length)]);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/security/authentication/kerberos/AmbariKerberosAuthenticationProperties.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/authentication/kerberos/AmbariKerberosAuthenticationProperties.java b/ambari-server/src/main/java/org/apache/ambari/server/security/authentication/kerberos/AmbariKerberosAuthenticationProperties.java
index c59ec35..09422e5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/authentication/kerberos/AmbariKerberosAuthenticationProperties.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/authentication/kerberos/AmbariKerberosAuthenticationProperties.java
@@ -127,7 +127,7 @@ public class AmbariKerberosAuthenticationProperties {
if (orderedUserTypes == null) {
this.orderedUserTypes = Collections.emptyList();
} else {
- this.orderedUserTypes = Collections.unmodifiableList(new ArrayList<UserType>(orderedUserTypes));
+ this.orderedUserTypes = Collections.unmodifiableList(new ArrayList<>(orderedUserTypes));
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProvider.java
index a35e7eb..b7ff297 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariLdapAuthenticationProvider.java
@@ -49,8 +49,8 @@ public class AmbariLdapAuthenticationProvider implements AuthenticationProvider
private AmbariLdapAuthoritiesPopulator authoritiesPopulator;
private UserDAO userDAO;
- private ThreadLocal<LdapServerProperties> ldapServerProperties = new ThreadLocal<LdapServerProperties>();
- private ThreadLocal<LdapAuthenticationProvider> providerThreadLocal = new ThreadLocal<LdapAuthenticationProvider>();
+ private ThreadLocal<LdapServerProperties> ldapServerProperties = new ThreadLocal<>();
+ private ThreadLocal<LdapAuthenticationProvider> providerThreadLocal = new ThreadLocal<>();
private ThreadLocal<String> ldapUserSearchFilterThreadLocal = new ThreadLocal<>();
@Inject
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariPamAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariPamAuthenticationProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariPamAuthenticationProvider.java
index ab66271..ca7cd31 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariPamAuthenticationProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/AmbariPamAuthenticationProvider.java
@@ -112,7 +112,7 @@ public class AmbariPamAuthenticationProvider implements AuthenticationProvider {
//Get all the groups that user belongs to
//Change all group names to lower case.
- Set<String> groups = new HashSet<String>();
+ Set<String> groups = new HashSet<>();
for(String group: unixUser.getGroups()){
groups.add(group.toLowerCase());
@@ -241,7 +241,7 @@ public class AmbariPamAuthenticationProvider implements AuthenticationProvider {
*/
private Set<String> getUserGroups(String userName, UserType userType) {
UserEntity userEntity = userDAO.findUserByNameAndType(userName, userType);
- Set<String> groups = new HashSet<String>();
+ Set<String> groups = new HashSet<>();
for (MemberEntity memberEntity: userEntity.getMemberEntities()) {
groups.add(memberEntity.getGroup().getGroupName());
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/LdapServerProperties.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/LdapServerProperties.java b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/LdapServerProperties.java
index 7ee3adc..e06d8f2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/LdapServerProperties.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/LdapServerProperties.java
@@ -72,7 +72,7 @@ public class LdapServerProperties {
if (StringUtils.isEmpty(primaryUrl)) {
return Collections.emptyList();
} else {
- List<String> list = new ArrayList<String>();
+ List<String> list = new ArrayList<>();
list.add(protocol + primaryUrl);
if (!StringUtils.isEmpty(secondaryUrl)) {
list.add(protocol + secondaryUrl);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/User.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/User.java b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/User.java
index 18509d3..8039759 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/User.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/User.java
@@ -39,7 +39,7 @@ public class User {
final UserType userType;
final Date createTime;
final boolean active;
- final Collection<String> groups = new ArrayList<String>();
+ final Collection<String> groups = new ArrayList<>();
boolean admin = false;
final List<GrantedAuthority> authorities = new ArrayList<>();
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java
index fbd40a0..4ed777b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java
@@ -108,7 +108,7 @@ public class Users {
public List<User> getAllUsers() {
List<UserEntity> userEntities = userDAO.findAll();
- List<User> users = new ArrayList<User>(userEntities.size());
+ List<User> users = new ArrayList<>(userEntities.size());
for (UserEntity userEntity : userEntities) {
users.add(new User(userEntity));
@@ -393,7 +393,7 @@ public class Users {
if (groupEntity == null) {
return null;
} else {
- final Set<User> users = new HashSet<User>();
+ final Set<User> users = new HashSet<>();
for (MemberEntity memberEntity : groupEntity.getMemberEntities()) {
if (memberEntity.getUser() != null) {
users.add(new User(memberEntity.getUser()));
@@ -438,7 +438,7 @@ public class Users {
*/
public List<Group> getAllGroups() {
final List<GroupEntity> groupEntities = groupDAO.findAll();
- final List<Group> groups = new ArrayList<Group>(groupEntities.size());
+ final List<Group> groups = new ArrayList<>(groupEntities.size());
for (GroupEntity groupEntity : groupEntities) {
groups.add(new Group(groupEntity));
@@ -454,7 +454,7 @@ public class Users {
* @return list of user names
*/
public List<String> getAllMembers(String groupName) throws AmbariException {
- final List<String> members = new ArrayList<String>();
+ final List<String> members = new ArrayList<>();
final GroupEntity groupEntity = groupDAO.findGroupByName(groupName);
if (groupEntity == null) {
throw new AmbariException("Group " + groupName + " doesn't exist");
@@ -607,7 +607,7 @@ public class Users {
*/
public synchronized boolean isUserCanBeRemoved(UserEntity userEntity) {
List<PrincipalEntity> adminPrincipals = principalDAO.findByPermissionId(PermissionEntity.AMBARI_ADMINISTRATOR_PERMISSION);
- Set<UserEntity> userEntitysSet = new HashSet<UserEntity>(userDAO.findUsersByPrincipal(adminPrincipals));
+ Set<UserEntity> userEntitysSet = new HashSet<>(userDAO.findUsersByPrincipal(adminPrincipals));
return (userEntitysSet.contains(userEntity) && userEntitysSet.size() < 2) ? false : true;
}
@@ -633,8 +633,8 @@ public class Users {
* @param batchInfo DTO with batch information
*/
public void processLdapSync(LdapBatchDto batchInfo) {
- final Map<String, UserEntity> allUsers = new HashMap<String, UserEntity>();
- final Map<String, GroupEntity> allGroups = new HashMap<String, GroupEntity>();
+ final Map<String, UserEntity> allUsers = new HashMap<>();
+ final Map<String, GroupEntity> allGroups = new HashMap<>();
// prefetch all user and group data to avoid heavy queries in membership creation
@@ -652,7 +652,7 @@ public class Users {
.ensurePrincipalTypeCreated(PrincipalTypeEntity.GROUP_PRINCIPAL_TYPE);
// remove users
- final Set<UserEntity> usersToRemove = new HashSet<UserEntity>();
+ final Set<UserEntity> usersToRemove = new HashSet<>();
for (String userName : batchInfo.getUsersToBeRemoved()) {
UserEntity userEntity = userDAO.findUserByName(userName);
if (userEntity == null) {
@@ -664,7 +664,7 @@ public class Users {
userDAO.remove(usersToRemove);
// remove groups
- final Set<GroupEntity> groupsToRemove = new HashSet<GroupEntity>();
+ final Set<GroupEntity> groupsToRemove = new HashSet<>();
for (String groupName : batchInfo.getGroupsToBeRemoved()) {
final GroupEntity groupEntity = groupDAO.findGroupByName(groupName);
allGroups.remove(groupEntity.getGroupName());
@@ -673,7 +673,7 @@ public class Users {
groupDAO.remove(groupsToRemove);
// update users
- final Set<UserEntity> usersToBecomeLdap = new HashSet<UserEntity>();
+ final Set<UserEntity> usersToBecomeLdap = new HashSet<>();
for (String userName : batchInfo.getUsersToBecomeLdap()) {
UserEntity userEntity = userDAO.findLocalUserByName(userName);
if (userEntity == null) {
@@ -689,7 +689,7 @@ public class Users {
userDAO.merge(usersToBecomeLdap);
// update groups
- final Set<GroupEntity> groupsToBecomeLdap = new HashSet<GroupEntity>();
+ final Set<GroupEntity> groupsToBecomeLdap = new HashSet<>();
for (String groupName : batchInfo.getGroupsToBecomeLdap()) {
final GroupEntity groupEntity = groupDAO.findGroupByName(groupName);
groupEntity.setGroupType(GroupType.LDAP);
@@ -699,10 +699,10 @@ public class Users {
groupDAO.merge(groupsToBecomeLdap);
// prepare create principals
- final List<PrincipalEntity> principalsToCreate = new ArrayList<PrincipalEntity>();
+ final List<PrincipalEntity> principalsToCreate = new ArrayList<>();
// prepare create users
- final Set<UserEntity> usersToCreate = new HashSet<UserEntity>();
+ final Set<UserEntity> usersToCreate = new HashSet<>();
for (String userName : batchInfo.getUsersToBeCreated()) {
final PrincipalEntity principalEntity = new PrincipalEntity();
principalEntity.setPrincipalType(userPrincipalType);
@@ -719,7 +719,7 @@ public class Users {
}
// prepare create groups
- final Set<GroupEntity> groupsToCreate = new HashSet<GroupEntity>();
+ final Set<GroupEntity> groupsToCreate = new HashSet<>();
for (String groupName : batchInfo.getGroupsToBeCreated()) {
final PrincipalEntity principalEntity = new PrincipalEntity();
principalEntity.setPrincipalType(groupPrincipalType);
@@ -740,8 +740,8 @@ public class Users {
groupDAO.create(groupsToCreate);
// create membership
- final Set<MemberEntity> membersToCreate = new HashSet<MemberEntity>();
- final Set<GroupEntity> groupsToUpdate = new HashSet<GroupEntity>();
+ final Set<MemberEntity> membersToCreate = new HashSet<>();
+ final Set<GroupEntity> groupsToUpdate = new HashSet<>();
for (LdapUserGroupMemberDto member : batchInfo.getMembershipToAdd()) {
final MemberEntity memberEntity = new MemberEntity();
final GroupEntity groupEntity = allGroups.get(member.getGroupName());
@@ -755,7 +755,7 @@ public class Users {
groupDAO.merge(groupsToUpdate); // needed for Derby DB as it doesn't fetch newly added members automatically
// remove membership
- final Set<MemberEntity> membersToRemove = new HashSet<MemberEntity>();
+ final Set<MemberEntity> membersToRemove = new HashSet<>();
for (LdapUserGroupMemberDto member : batchInfo.getMembershipToRemove()) {
MemberEntity memberEntity = memberDAO.findByUserAndGroup(member.getUserName(), member.getGroupName());
if (memberEntity != null) {
@@ -820,7 +820,7 @@ public class Users {
}
// get all of the privileges for the user
- List<PrincipalEntity> principalEntities = new LinkedList<PrincipalEntity>();
+ List<PrincipalEntity> principalEntities = new LinkedList<>();
principalEntities.add(userEntity.getPrincipal());
@@ -837,7 +837,7 @@ public class Users {
if (implicitPrivilegeEntities.isEmpty()) {
privilegeEntities = explicitPrivilegeEntities;
} else {
- privilegeEntities = new LinkedList<PrivilegeEntity>();
+ privilegeEntities = new LinkedList<>();
privilegeEntities.addAll(explicitPrivilegeEntities);
privilegeEntities.addAll(implicitPrivilegeEntities);
}
@@ -867,7 +867,7 @@ public class Users {
}
// get all of the privileges for the group
- List<PrincipalEntity> principalEntities = new LinkedList<PrincipalEntity>();
+ List<PrincipalEntity> principalEntities = new LinkedList<>();
principalEntities.add(groupEntity.getPrincipal());
@@ -878,7 +878,7 @@ public class Users {
if (implicitPrivilegeEntities.isEmpty()) {
privilegeEntities = explicitPrivilegeEntities;
} else {
- privilegeEntities = new LinkedList<PrivilegeEntity>();
+ privilegeEntities = new LinkedList<>();
privilegeEntities.addAll(explicitPrivilegeEntities);
privilegeEntities.addAll(implicitPrivilegeEntities);
}
@@ -938,13 +938,13 @@ public class Users {
return Collections.emptyList();
}
- List<PrivilegeEntity> implicitPrivileges = new LinkedList<PrivilegeEntity>();
+ List<PrivilegeEntity> implicitPrivileges = new LinkedList<>();
// A list of principals representing roles/permissions. This collection of roles will be used to
// find additional inherited privileges based on the assigned roles.
// For example a File View instance may be set to be accessible to all authenticated user with
// the Cluster User role.
- List<PrincipalEntity> rolePrincipals = new ArrayList<PrincipalEntity>();
+ List<PrincipalEntity> rolePrincipals = new ArrayList<>();
for (PrivilegeEntity privilegeEntity : privilegeEntities) {
// Add the principal representing the role associated with this PrivilegeEntity to the collection
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/jwt/JwtAuthenticationProperties.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/jwt/JwtAuthenticationProperties.java b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/jwt/JwtAuthenticationProperties.java
index 7d84213..cb456fa 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/jwt/JwtAuthenticationProperties.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/authorization/jwt/JwtAuthenticationProperties.java
@@ -62,7 +62,7 @@ public class JwtAuthenticationProperties {
if (StringUtils.isNotEmpty(audiencesString)) {
// parse into the list
String[] audArray = audiencesString.split(",");
- audiences = new ArrayList<String>();
+ audiences = new ArrayList<>();
Collections.addAll(audiences, audArray);
} else {
audiences = null;
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/AbstractCredentialStore.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/AbstractCredentialStore.java b/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/AbstractCredentialStore.java
index 76c0ac0..fb5e0db 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/AbstractCredentialStore.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/AbstractCredentialStore.java
@@ -159,7 +159,7 @@ public abstract class AbstractCredentialStore implements CredentialStore {
Enumeration<String> aliases = ks.aliases();
if (aliases != null) {
- credentials = new HashSet<String>();
+ credentials = new HashSet<>();
while (aliases.hasMoreElements()) {
credentials.add(aliases.nextElement());
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialStoreServiceImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialStoreServiceImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialStoreServiceImpl.java
index c48029b..c36d21f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialStoreServiceImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/CredentialStoreServiceImpl.java
@@ -201,7 +201,7 @@ public class CredentialStoreServiceImpl implements CredentialStoreService {
? temporaryCredentialStore.listCredentials()
: null;
- Map<String, CredentialStoreType> map = new HashMap<String, CredentialStoreType>();
+ Map<String, CredentialStoreType> map = new HashMap<>();
if (persistedAliases != null) {
for (String alias : persistedAliases) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/InMemoryCredentialStore.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/InMemoryCredentialStore.java b/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/InMemoryCredentialStore.java
index 930136e..c0ee6a8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/InMemoryCredentialStore.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/InMemoryCredentialStore.java
@@ -195,7 +195,7 @@ public class InMemoryCredentialStore extends AbstractCredentialStore {
Lock lock = getLock();
lock.lock();
try {
- return new HashSet<String>(cache.asMap().keySet());
+ return new HashSet<>(cache.asMap().keySet());
} finally {
lock.unlock();
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/MasterKeyServiceImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/MasterKeyServiceImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/MasterKeyServiceImpl.java
index 1dd0f85..1d6b73d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/MasterKeyServiceImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/encryption/MasterKeyServiceImpl.java
@@ -180,7 +180,7 @@ public class MasterKeyServiceImpl implements MasterKeyService {
if (atom != null) {
try {
- ArrayList<String> lines = new ArrayList<String>();
+ ArrayList<String> lines = new ArrayList<>();
lines.add(MASTER_PERSISTENCE_TAG_PREFIX + TimeStamp.getCurrentTime().toDateString());
String line = Base64.encodeBase64String((
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/security/ldap/AmbariLdapDataPopulator.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/ldap/AmbariLdapDataPopulator.java b/ambari-server/src/main/java/org/apache/ambari/server/security/ldap/AmbariLdapDataPopulator.java
index c134c51..32dd6dc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/ldap/AmbariLdapDataPopulator.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/ldap/AmbariLdapDataPopulator.java
@@ -245,7 +245,7 @@ public class AmbariLdapDataPopulator {
*/
public LdapBatchDto synchronizeLdapGroups(Set<String> groups, LdapBatchDto batchInfo) throws AmbariException {
LOG.trace("Synchronize LDAP groups...");
- final Set<LdapGroupDto> specifiedGroups = new HashSet<LdapGroupDto>();
+ final Set<LdapGroupDto> specifiedGroups = new HashSet<>();
for (String group : groups) {
Set<LdapGroupDto> groupDtos = getLdapGroups(group);
if (groupDtos.isEmpty()) {
@@ -275,7 +275,7 @@ public class AmbariLdapDataPopulator {
*/
public LdapBatchDto synchronizeLdapUsers(Set<String> users, LdapBatchDto batchInfo) throws AmbariException {
LOG.trace("Synchronize LDAP users...");
- final Set<LdapUserDto> specifiedUsers = new HashSet<LdapUserDto>();
+ final Set<LdapUserDto> specifiedUsers = new HashSet<>();
for (String user : users) {
Set<LdapUserDto> userDtos = getLdapUsers(user);
@@ -369,10 +369,10 @@ public class AmbariLdapDataPopulator {
protected void refreshGroupMembers(LdapBatchDto batchInfo, LdapGroupDto group, Map<String, User> internalUsers,
Map<String, Group> internalGroupsMap, Set<String> groupMemberAttributes, boolean recursive)
throws AmbariException {
- Set<String> externalMembers = new HashSet<String>();
+ Set<String> externalMembers = new HashSet<>();
if (groupMemberAttributes == null) {
- groupMemberAttributes = new HashSet<String>();
+ groupMemberAttributes = new HashSet<>();
}
for (String memberAttributeValue : group.getMemberAttributes()) {
@@ -623,7 +623,7 @@ public class AmbariLdapDataPopulator {
}
private Set<LdapGroupDto> getFilteredLdapGroups(String baseDn, Filter filter) {
- final Set<LdapGroupDto> groups = new HashSet<LdapGroupDto>();
+ final Set<LdapGroupDto> groups = new HashSet<>();
final LdapTemplate ldapTemplate = loadLdapTemplate();
LOG.trace("LDAP Group Query - Base DN: '{}' ; Filter: '{}'", baseDn, filter.encode());
ldapTemplate.search(baseDn, filter.encode(),
@@ -651,7 +651,7 @@ public class AmbariLdapDataPopulator {
}
private Set<LdapUserDto> getFilteredLdapUsers(String baseDn, Filter filter) {
- final Set<LdapUserDto> users = new HashSet<LdapUserDto>();
+ final Set<LdapUserDto> users = new HashSet<>();
final LdapTemplate ldapTemplate = loadLdapTemplate();
PagedResultsDirContextProcessor processor = createPagingProcessor();
SearchControls searchControls = new SearchControls();
@@ -682,7 +682,7 @@ public class AmbariLdapDataPopulator {
*/
protected Map<String, Group> getInternalGroups() {
final List<Group> internalGroups = users.getAllGroups();
- final Map<String, Group> internalGroupsMap = new HashMap<String, Group>();
+ final Map<String, Group> internalGroupsMap = new HashMap<>();
for (Group group : internalGroups) {
internalGroupsMap.put(group.getGroupName(), group);
}
@@ -696,7 +696,7 @@ public class AmbariLdapDataPopulator {
*/
protected Map<String, User> getInternalUsers() {
final List<User> internalUsers = users.getAllUsers();
- final Map<String, User> internalUsersMap = new HashMap<String, User>();
+ final Map<String, User> internalUsersMap = new HashMap<>();
LOG.trace("Get all users from Ambari Server.");
for (User user : internalUsers) {
internalUsersMap.put(user.getUserName(), user);
@@ -715,7 +715,7 @@ public class AmbariLdapDataPopulator {
if (internalMembers == null) {
return Collections.emptyMap();
}
- final Map<String, User> internalMembersMap = new HashMap<String, User>();
+ final Map<String, User> internalMembersMap = new HashMap<>();
for (User user : internalMembers) {
internalMembersMap.put(user.getUserName(), user);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/security/ldap/LdapBatchDto.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/ldap/LdapBatchDto.java b/ambari-server/src/main/java/org/apache/ambari/server/security/ldap/LdapBatchDto.java
index e328722..7e3a575 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/ldap/LdapBatchDto.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/ldap/LdapBatchDto.java
@@ -24,16 +24,16 @@ import java.util.Set;
* Contains information for batch database update on LDAP synchronization.
*/
public class LdapBatchDto {
- private final Set<String> groupsToBecomeLdap = new HashSet<String>();
- private final Set<String> groupsToBeCreated = new HashSet<String>();
- private final Set<String> groupsToBeRemoved = new HashSet<String>();
+ private final Set<String> groupsToBecomeLdap = new HashSet<>();
+ private final Set<String> groupsToBeCreated = new HashSet<>();
+ private final Set<String> groupsToBeRemoved = new HashSet<>();
private final Set<String> groupsProcessedInternal = new HashSet<>();
- private final Set<String> usersSkipped = new HashSet<String>();
- private final Set<String> usersToBecomeLdap = new HashSet<String>();
- private final Set<String> usersToBeCreated = new HashSet<String>();
- private final Set<String> usersToBeRemoved = new HashSet<String>();
- private final Set<LdapUserGroupMemberDto> membershipToAdd = new HashSet<LdapUserGroupMemberDto>();
- private final Set<LdapUserGroupMemberDto> membershipToRemove = new HashSet<LdapUserGroupMemberDto>();
+ private final Set<String> usersSkipped = new HashSet<>();
+ private final Set<String> usersToBecomeLdap = new HashSet<>();
+ private final Set<String> usersToBeCreated = new HashSet<>();
+ private final Set<String> usersToBeRemoved = new HashSet<>();
+ private final Set<LdapUserGroupMemberDto> membershipToAdd = new HashSet<>();
+ private final Set<LdapUserGroupMemberDto> membershipToRemove = new HashSet<>();
public Set<String> getUsersSkipped() {
return usersSkipped;
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/security/ldap/LdapGroupDto.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/ldap/LdapGroupDto.java b/ambari-server/src/main/java/org/apache/ambari/server/security/ldap/LdapGroupDto.java
index 132cbe5..4b1e376 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/ldap/LdapGroupDto.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/ldap/LdapGroupDto.java
@@ -32,7 +32,7 @@ public class LdapGroupDto {
/**
* Set of member attributes. Usually it's either UID or DN of users.
*/
- private Set<String> memberAttributes = new HashSet<String>();
+ private Set<String> memberAttributes = new HashSet<>();
/**
* Determines if the LDAP group is synchronized with internal group in database.
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/security/ldap/LdapSyncDto.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/ldap/LdapSyncDto.java b/ambari-server/src/main/java/org/apache/ambari/server/security/ldap/LdapSyncDto.java
index 6bd2ab9..3f60350 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/ldap/LdapSyncDto.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/ldap/LdapSyncDto.java
@@ -27,12 +27,12 @@ public class LdapSyncDto {
/**
* LDAP groups.
*/
- private Set<LdapGroupDto> groups = new HashSet<LdapGroupDto>();
+ private Set<LdapGroupDto> groups = new HashSet<>();
/**
* LDAP users.
*/
- private Set<LdapUserDto> users = new HashSet<LdapUserDto>();
+ private Set<LdapUserDto> users = new HashSet<>();
/**
* Get the LDAP groups.
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/security/unsecured/rest/ConnectionInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/security/unsecured/rest/ConnectionInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/security/unsecured/rest/ConnectionInfo.java
index cb25f0b..3ed84a0 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/security/unsecured/rest/ConnectionInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/security/unsecured/rest/ConnectionInfo.java
@@ -35,7 +35,7 @@ import com.google.inject.Inject;
@Path("/connection_info")
public class ConnectionInfo {
private static Log LOG = LogFactory.getLog(ConnectionInfo.class);
- private static HashMap<String,String> response=new HashMap<String,String>();
+ private static HashMap<String,String> response= new HashMap<>();
private static Configuration conf;
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerActionExecutor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerActionExecutor.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerActionExecutor.java
index b23d555..b0be6b3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerActionExecutor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/ServerActionExecutor.java
@@ -81,7 +81,7 @@ public class ServerActionExecutor {
* requestSharedDataMap object
*/
private final Map<Long, ConcurrentMap<String, Object>> requestSharedDataMap =
- new HashMap<Long, ConcurrentMap<String, Object>>();
+ new HashMap<>();
/**
* The hostname of the (Ambari) server.
@@ -233,7 +233,7 @@ public class ServerActionExecutor {
ConcurrentMap<String, Object> map = requestSharedDataMap.get(requestId);
if (map == null) {
- map = new ConcurrentHashMap<String, Object>();
+ map = new ConcurrentHashMap<>();
requestSharedDataMap.put(requestId, map);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/ADKerberosOperationHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/ADKerberosOperationHandler.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/ADKerberosOperationHandler.java
index 87dbeea..cd19174 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/ADKerberosOperationHandler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/ADKerberosOperationHandler.java
@@ -266,7 +266,7 @@ public class ADKerberosOperationHandler extends KerberosOperationHandler {
realm = "";
}
- Map<String, Object> context = new HashMap<String, Object>();
+ Map<String, Object> context = new HashMap<>();
context.put("normalized_principal", deconstructedPrincipal.getNormalizedPrincipal());
context.put("principal_name", deconstructedPrincipal.getPrincipalName());
context.put("principal_primary", deconstructedPrincipal.getPrimary());
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/AbstractPrepareKerberosServerAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/AbstractPrepareKerberosServerAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/AbstractPrepareKerberosServerAction.java
index 7824019..7aac346 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/AbstractPrepareKerberosServerAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/AbstractPrepareKerberosServerAction.java
@@ -92,7 +92,7 @@ public abstract class AbstractPrepareKerberosServerAction extends KerberosServer
KerberosIdentityDataFileWriter kerberosIdentityDataFileWriter;
// 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", currentConfigurations);
filterContext.put("services", cluster.getServices().keySet());
@@ -231,7 +231,7 @@ public abstract class AbstractPrepareKerberosServerAction extends KerberosServer
Map<String, Map<String, String>> identityConfigurations = kerberosHelper.getIdentityConfigurations(identities);
if ((identityConfigurations != null) && !identityConfigurations.isEmpty()) {
if (propertiesToIgnore == null) {
- propertiesToIgnore = new HashMap<String, Set<String>>();
+ propertiesToIgnore = new HashMap<>();
}
for (Map.Entry<String, Map<String, String>> entry : identityConfigurations.entrySet()) {
@@ -241,7 +241,7 @@ public abstract class AbstractPrepareKerberosServerAction extends KerberosServer
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());
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/CreateKeytabFilesServerAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/CreateKeytabFilesServerAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/CreateKeytabFilesServerAction.java
index 5d6ccc0..9ee5f11 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/CreateKeytabFilesServerAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/CreateKeytabFilesServerAction.java
@@ -86,7 +86,7 @@ public class CreateKeytabFilesServerAction extends KerberosServerAction {
* A map of data used to track what has been processed in order to optimize the creation of keytabs
* such as knowing when to create a cached keytab file or use a cached keytab file.
*/
- Map<String, Set<String>> visitedIdentities = new HashMap<String, Set<String>>();
+ Map<String, Set<String>> visitedIdentities = new HashMap<>();
/**
* Called to execute this action. Upon invocation, calls
@@ -274,7 +274,7 @@ public class CreateKeytabFilesServerAction extends KerberosServerAction {
}
if (visitedPrincipalKeys == null) {
- visitedPrincipalKeys = new HashSet<String>();
+ visitedPrincipalKeys = new HashSet<>();
visitedIdentities.put(evaluatedPrincipal, visitedPrincipalKeys);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/CreatePrincipalsServerAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/CreatePrincipalsServerAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/CreatePrincipalsServerAction.java
index c7df55f..2fd5abe 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/CreatePrincipalsServerAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/CreatePrincipalsServerAction.java
@@ -71,7 +71,7 @@ public class CreatePrincipalsServerAction extends KerberosServerAction {
* A set of visited principal names used to prevent unnecessary processing on already processed
* principal names
*/
- private Set<String> seenPrincipals = new HashSet<String>();
+ private Set<String> seenPrincipals = new HashSet<>();
/**
* Called to execute this action. Upon invocation, calls
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/DestroyPrincipalsServerAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/DestroyPrincipalsServerAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/DestroyPrincipalsServerAction.java
index 3f631b4..fc2de99 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/DestroyPrincipalsServerAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/DestroyPrincipalsServerAction.java
@@ -56,7 +56,7 @@ public class DestroyPrincipalsServerAction extends KerberosServerAction {
* A set of visited principal names used to prevent unnecessary processing on already processed
* principal names
*/
- private Set<String> seenPrincipals = new HashSet<String>();
+ private Set<String> seenPrincipals = new HashSet<>();
/**
* Called to execute this action. Upon invocation, calls
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/IPAKerberosOperationHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/IPAKerberosOperationHandler.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/IPAKerberosOperationHandler.java
index 37779c6..5923b72 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/IPAKerberosOperationHandler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/IPAKerberosOperationHandler.java
@@ -643,8 +643,8 @@ public class IPAKerberosOperationHandler extends KerberosOperationHandler {
PrincipalKeyCredential administratorCredentials = getAdministratorCredential();
String defaultRealm = getDefaultRealm();
- List<String> command = new ArrayList<String>();
- List<String> kinit = new ArrayList<String>();
+ List<String> command = new ArrayList<>();
+ List<String> kinit = new ArrayList<>();
String adminPrincipal = (administratorCredentials == null)
? null
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/KerberosOperationHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/KerberosOperationHandler.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/KerberosOperationHandler.java
index 3e5e54c..eea5071 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/KerberosOperationHandler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/KerberosOperationHandler.java
@@ -213,7 +213,7 @@ public abstract class KerberosOperationHandler {
private PrincipalKeyCredential administratorCredential = null;
private String defaultRealm = null;
- private Set<EncryptionType> keyEncryptionTypes = new HashSet<EncryptionType>(DEFAULT_CIPHERS);
+ private Set<EncryptionType> keyEncryptionTypes = new HashSet<>(DEFAULT_CIPHERS);
private boolean open = false;
/**
@@ -338,8 +338,8 @@ public abstract class KerberosOperationHandler {
throw new KerberosOperationException(String.format("Failed to create keytab file for %s, missing password", principal));
}
- Set<EncryptionType> ciphers = new HashSet<EncryptionType>(keyEncryptionTypes);
- List<KeytabEntry> keytabEntries = new ArrayList<KeytabEntry>();
+ Set<EncryptionType> ciphers = new HashSet<>(keyEncryptionTypes);
+ List<KeytabEntry> keytabEntries = new ArrayList<>();
Keytab keytab = new Keytab();
@@ -443,11 +443,11 @@ public abstract class KerberosOperationHandler {
protected Keytab mergeKeytabs(Keytab keytab, Keytab updates) {
List<KeytabEntry> keytabEntries = (keytab == null)
? Collections.<KeytabEntry>emptyList()
- : new ArrayList<KeytabEntry>(keytab.getEntries());
+ : new ArrayList<>(keytab.getEntries());
List<KeytabEntry> updateEntries = (updates == null)
? Collections.<KeytabEntry>emptyList()
- : new ArrayList<KeytabEntry>(updates.getEntries());
- List<KeytabEntry> mergedEntries = new ArrayList<KeytabEntry>();
+ : new ArrayList<>(updates.getEntries());
+ List<KeytabEntry> mergedEntries = new ArrayList<>();
if (keytabEntries.isEmpty()) {
mergedEntries.addAll(updateEntries);
@@ -569,10 +569,10 @@ public abstract class KerberosOperationHandler {
* @param keyEncryptionTypes a Set of EncryptionKey values or null to indicate the default set
*/
public void setKeyEncryptionTypes(Set<EncryptionType> keyEncryptionTypes) {
- this.keyEncryptionTypes = new HashSet<EncryptionType>(
- (keyEncryptionTypes == null)
- ? DEFAULT_CIPHERS
- : keyEncryptionTypes
+ this.keyEncryptionTypes = new HashSet<>(
+ (keyEncryptionTypes == null)
+ ? DEFAULT_CIPHERS
+ : keyEncryptionTypes
);
}
@@ -620,7 +620,7 @@ public abstract class KerberosOperationHandler {
List<String> searchPaths = null;
if (delimitedExecutableSearchPaths != null) {
- searchPaths = new ArrayList<String>();
+ searchPaths = new ArrayList<>();
for (String path : delimitedExecutableSearchPaths.split(",")) {
path = path.trim();
if (!path.isEmpty()) {
@@ -820,7 +820,7 @@ public abstract class KerberosOperationHandler {
* @return a Set of EncryptionType values
*/
protected Set<EncryptionType> translateEncryptionTypes(String names, String delimiter) {
- Set<EncryptionType> encryptionTypes = new HashSet<EncryptionType>();
+ Set<EncryptionType> encryptionTypes = new HashSet<>();
if (!StringUtils.isEmpty(names)) {
for (String name : names.split((delimiter == null) ? "\\s+" : delimiter)) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandler.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandler.java
index 309170b..55d7366 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandler.java
@@ -398,7 +398,7 @@ public class MITKerberosOperationHandler extends KerberosOperationHandler {
PrincipalKeyCredential administratorCredential = getAdministratorCredential();
String defaultRealm = getDefaultRealm();
- List<String> command = new ArrayList<String>();
+ List<String> command = new ArrayList<>();
String adminPrincipal = (administratorCredential == null)
? null
@@ -537,7 +537,7 @@ public class MITKerberosOperationHandler extends KerberosOperationHandler {
* @param userPassword the user's password (optional)
*/
public InteractivePasswordHandler(String adminPassword, String userPassword) {
- responses = new LinkedList<String>();
+ responses = new LinkedList<>();
if (adminPassword != null) {
responses.offer(adminPassword);
@@ -548,7 +548,7 @@ public class MITKerberosOperationHandler extends KerberosOperationHandler {
responses.offer(userPassword); // Add a 2nd time for the password "confirmation" request
}
- currentResponses = new LinkedList<String>(responses);
+ currentResponses = new LinkedList<>(responses);
}
@Override
@@ -563,7 +563,7 @@ public class MITKerberosOperationHandler extends KerberosOperationHandler {
@Override
public void start() {
- currentResponses = new LinkedList<String>(responses);
+ currentResponses = new LinkedList<>(responses);
}
}
}