AMBARI-19617 - Restarting Some Components During a Suspended Upgrade Fails Due To Missing Upgrade Parameters (jonathanhurley)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d540f943 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d540f943 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d540f943 Branch: refs/heads/trunk Commit: d540f943da59d196b377a9e15fcd2e6dcb50483b Parents: de8bf60 Author: Jonathan Hurley <jhur...@hortonworks.com> Authored: Wed Jan 18 20:33:43 2017 -0500 Committer: Jonathan Hurley <jhur...@hortonworks.com> Committed: Thu Jan 19 16:11:09 2017 -0500 ---------------------------------------------------------------------- .../controller/AmbariActionExecutionHelper.java | 13 +- .../AmbariCustomCommandExecutionHelper.java | 60 +++--- .../AmbariManagementControllerImpl.java | 183 +++++++++--------- .../internal/UpgradeResourceProvider.java | 154 +++++---------- .../org/apache/ambari/server/state/Cluster.java | 14 ++ .../ambari/server/state/UpgradeContext.java | 191 ++++++++++++++++--- .../server/state/UpgradeContextFactory.java | 25 ++- .../server/state/cluster/ClusterImpl.java | 106 ++++++---- .../ambari/server/agent/AgentResourceTest.java | 4 + .../server/controller/KerberosHelperTest.java | 105 +++++----- .../ActiveWidgetLayoutResourceProviderTest.java | 17 +- .../UserAuthorizationResourceProviderTest.java | 9 +- .../internal/UserResourceProviderTest.java | 19 +- .../ambari/server/state/ConfigHelperTest.java | 98 +++++----- .../ambari/server/state/UpgradeHelperTest.java | 167 +++++++--------- .../cluster/ClusterEffectiveVersionTest.java | 2 + .../stack/upgrade/StageWrapperBuilderTest.java | 46 ++++- 17 files changed, 694 insertions(+), 519 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/d540f943/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariActionExecutionHelper.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariActionExecutionHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariActionExecutionHelper.java index ec0f7d0..d556b60 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariActionExecutionHelper.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariActionExecutionHelper.java @@ -270,7 +270,7 @@ public class AmbariActionExecutionHelper { } // List of host to select from - Set<String> candidateHosts = new HashSet<String>(); + Set<String> candidateHosts = new HashSet<>(); final String serviceName = actionContext.getExpectedServiceName(); final String componentName = actionContext.getExpectedComponentName(); @@ -394,7 +394,7 @@ public class AmbariActionExecutionHelper { clusterName, serviceName, actionContext.isRetryAllowed(), actionContext.isFailureAutoSkipped()); - Map<String, String> commandParams = new TreeMap<String, String>(); + Map<String, String> commandParams = new TreeMap<>(); int taskTimeout = Integer.parseInt(configs.getDefaultAgentTaskTimeout(false)); @@ -435,15 +435,13 @@ public class AmbariActionExecutionHelper { // when building complex orchestration ahead of time (such as when // performing ugprades), fetching configuration tags can take a very long // time - if it's not needed, then don't do it - Map<String, Map<String, String>> configTags = new TreeMap<String, Map<String, String>>(); + Map<String, Map<String, String>> configTags = new TreeMap<>(); if (!execCmd.getForceRefreshConfigTagsBeforeExecution()) { configTags = managementController.findConfigurationTagsWithOverrides(cluster, hostName); } execCmd.setConfigurationTags(configTags); - execCmd.setCommandParams(commandParams); - execCmd.setServiceName(serviceName == null || serviceName.isEmpty() ? resourceFilter.getServiceName() : serviceName); @@ -463,7 +461,7 @@ public class AmbariActionExecutionHelper { Map<String, String> roleParams = execCmd.getRoleParams(); if (roleParams == null) { - roleParams = new TreeMap<String, String>(); + roleParams = new TreeMap<>(); } roleParams.putAll(actionParameters); @@ -477,9 +475,10 @@ public class AmbariActionExecutionHelper { // if there is a stack upgrade which is currently suspended then pass that // information down with the command as some components may need to know if (null != cluster && cluster.isUpgradeSuspended()) { - roleParams.put(KeyNames.UPGRADE_SUSPENDED, Boolean.TRUE.toString().toLowerCase()); + cluster.addSuspendedUpgradeParameters(commandParams, roleParams); } + execCmd.setCommandParams(commandParams); execCmd.setRoleParams(roleParams); if (null != cluster) { http://git-wip-us.apache.org/repos/asf/ambari/blob/d540f943/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java index bdad015..923a796 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java @@ -125,7 +125,7 @@ public class AmbariCustomCommandExecutionHelper { AmbariCustomCommandExecutionHelper.class); // TODO: Remove the hard-coded mapping when stack definition indicates which slave types can be decommissioned - public static final Map<String, String> masterToSlaveMappingForDecom = new HashMap<String, String>(); + public static final Map<String, String> masterToSlaveMappingForDecom = new HashMap<>(); static { masterToSlaveMappingForDecom.put("NAMENODE", "DATANODE"); @@ -276,7 +276,7 @@ public class AmbariCustomCommandExecutionHelper { final Cluster cluster = clusters.getCluster(clusterName); // start with all hosts - Set<String> candidateHosts = new HashSet<String>(resourceFilter.getHostNames()); + Set<String> candidateHosts = new HashSet<>(resourceFilter.getHostNames()); // Filter hosts that are in MS Set<String> ignoredHosts = maintenanceStateHelper.filterHostsInMaintenanceState( @@ -325,7 +325,6 @@ public class AmbariCustomCommandExecutionHelper { (stackId.getStackName(), stackId.getStackVersion()); ClusterVersionEntity effectiveClusterVersion = cluster.getEffectiveClusterVersion(); - boolean isUpgradeSuspended = cluster.isUpgradeSuspended(); CustomCommandDefinition customCommandDefinition = null; ComponentInfo ci = serviceInfo.getComponentByName(componentName); @@ -345,10 +344,10 @@ public class AmbariCustomCommandExecutionHelper { cluster.getClusterName(), serviceName, retryAllowed, autoSkipFailure); Map<String, Map<String, String>> configurations = - new TreeMap<String, Map<String, String>>(); + new TreeMap<>(); Map<String, Map<String, Map<String, String>>> configurationAttributes = - new TreeMap<String, Map<String, Map<String, String>>>(); - Map<String, Map<String, String>> configTags = new TreeMap<String, Map<String, String>>(); + new TreeMap<>(); + Map<String, Map<String, String>> configTags = new TreeMap<>(); ExecutionCommand execCmd = stage.getExecutionCommandWrapper(hostName, componentName).getExecutionCommand(); @@ -383,7 +382,7 @@ public class AmbariCustomCommandExecutionHelper { execCmd.setAvailableServicesFromServiceInfoMap(ambariMetaInfo.getServices(stackId.getStackName(), stackId.getStackVersion())); - Map<String, String> hostLevelParams = new TreeMap<String, String>(); + Map<String, String> hostLevelParams = new TreeMap<>(); hostLevelParams.put(CUSTOM_COMMAND, commandName); @@ -408,7 +407,7 @@ public class AmbariCustomCommandExecutionHelper { execCmd.setHostLevelParams(hostLevelParams); - Map<String, String> commandParams = new TreeMap<String, String>(); + Map<String, String> commandParams = new TreeMap<>(); if (additionalCommandParams != null) { for (String key : additionalCommandParams.keySet()) { commandParams.put(key, additionalCommandParams.get(key)); @@ -449,20 +448,21 @@ public class AmbariCustomCommandExecutionHelper { commandParams.put(KeyNames.VERSION, effectiveClusterVersion.getRepositoryVersion().getVersion()); } - execCmd.setCommandParams(commandParams); - Map<String, String> roleParams = execCmd.getRoleParams(); if (roleParams == null) { - roleParams = new TreeMap<String, String>(); + roleParams = new TreeMap<>(); } // if there is a stack upgrade which is currently suspended then pass that // information down with the command as some components may need to know + boolean isUpgradeSuspended = cluster.isUpgradeSuspended(); if (isUpgradeSuspended) { - roleParams.put(KeyNames.UPGRADE_SUSPENDED, Boolean.TRUE.toString().toLowerCase()); + cluster.addSuspendedUpgradeParameters(commandParams, roleParams); } roleParams.put(COMPONENT_CATEGORY, componentInfo.getCategory()); + + execCmd.setCommandParams(commandParams); execCmd.setRoleParams(roleParams); // perform any server side command related logic - eg - set desired states on restart @@ -523,7 +523,7 @@ public class AmbariCustomCommandExecutionHelper { // Otherwise, use candidates that contain the component. List<String> candidateHostsList = resourceFilter.getHostNames(); if (candidateHostsList != null && !candidateHostsList.isEmpty()) { - candidateHosts = new HashSet<String>(candidateHostsList); + candidateHosts = new HashSet<>(candidateHostsList); // Get the intersection. candidateHosts.retainAll(serviceHostComponents.keySet()); @@ -570,7 +570,7 @@ public class AmbariCustomCommandExecutionHelper { } // Filter out hosts that are in maintenance mode - they should never be included in service checks - Set<String> hostsInMaintenanceMode = new HashSet<String>(); + Set<String> hostsInMaintenanceMode = new HashSet<>(); if (actionExecutionContext.isMaintenanceModeHostExcluded()) { Iterator<String> iterator = candidateHosts.iterator(); while (iterator.hasNext()) { @@ -675,10 +675,10 @@ public class AmbariCustomCommandExecutionHelper { } // [ type -> [ key, value ] ] Map<String, Map<String, String>> configurations = - new TreeMap<String, Map<String, String>>(); + new TreeMap<>(); Map<String, Map<String, Map<String, String>>> configurationAttributes = - new TreeMap<String, Map<String, Map<String, String>>>(); - Map<String, Map<String, String>> configTags = new TreeMap<String, Map<String, String>>(); + new TreeMap<>(); + Map<String, Map<String, String>> configTags = new TreeMap<>(); ExecutionCommand execCmd = stage.getExecutionCommandWrapper(hostname, smokeTestRole).getExecutionCommand(); @@ -709,7 +709,7 @@ public class AmbariCustomCommandExecutionHelper { execCmd.getLocalComponents().add(sch.getServiceComponentName()); } - Map<String, String> commandParams = new TreeMap<String, String>(); + Map<String, String> commandParams = new TreeMap<>(); //Propagate HCFS service type info Map<String, ServiceInfo> serviceInfos = ambariMetaInfo.getServices(stackId.getStackName(), stackId.getStackVersion()); @@ -755,7 +755,7 @@ public class AmbariCustomCommandExecutionHelper { } private Set<String> getHostList(Map<String, String> cmdParameters, String key) { - Set<String> hosts = new HashSet<String>(); + Set<String> hosts = new HashSet<>(); if (cmdParameters.containsKey(key)) { String allHosts = cmdParameters.get(key); if (allHosts != null) { @@ -792,7 +792,7 @@ public class AmbariCustomCommandExecutionHelper { DECOM_INCLUDED_HOSTS); - Set<String> cloneSet = new HashSet<String>(excludedHosts); + Set<String> cloneSet = new HashSet<>(excludedHosts); cloneSet.retainAll(includedHosts); if (cloneSet.size() > 0) { throw new AmbariException("Same host cannot be specified for inclusion " + @@ -877,7 +877,7 @@ public class AmbariCustomCommandExecutionHelper { } }; // Filter excluded hosts - Set<String> filteredExcludedHosts = new HashSet<String>(excludedHosts); + Set<String> filteredExcludedHosts = new HashSet<>(excludedHosts); Set<String> ignoredHosts = maintenanceStateHelper.filterHostsInMaintenanceState( filteredExcludedHosts, hostPredicate); if (! ignoredHosts.isEmpty()) { @@ -889,7 +889,7 @@ public class AmbariCustomCommandExecutionHelper { } // Filter included hosts - Set<String> filteredIncludedHosts = new HashSet<String>(includedHosts); + Set<String> filteredIncludedHosts = new HashSet<>(includedHosts); ignoredHosts = maintenanceStateHelper.filterHostsInMaintenanceState( filteredIncludedHosts, hostPredicate); if (! ignoredHosts.isEmpty()) { @@ -913,7 +913,7 @@ public class AmbariCustomCommandExecutionHelper { String alignMtnStateStr = actionExecutionContext.getParameters().get(ALIGN_MAINTENANCE_STATE); boolean alignMtnState = "true".equals(alignMtnStateStr); // Set/reset decommissioned flag on all components - List<String> listOfExcludedHosts = new ArrayList<String>(); + List<String> listOfExcludedHosts = new ArrayList<>(); for (ServiceComponentHost sch : svcComponents.get(slaveCompType).getServiceComponentHosts().values()) { if (filteredExcludedHosts.contains(sch.getHostName())) { sch.setComponentAdminState(HostComponentAdminState.DECOMMISSIONED); @@ -956,7 +956,7 @@ public class AmbariCustomCommandExecutionHelper { for (String hostName : masterSchs.keySet()) { RequestResourceFilter commandFilter = new RequestResourceFilter(serviceName, masterComponent.getName(), Collections.singletonList(hostName)); - List<RequestResourceFilter> resourceFilters = new ArrayList<RequestResourceFilter>(); + List<RequestResourceFilter> resourceFilters = new ArrayList<>(); resourceFilters.add(commandFilter); ActionExecutionContext commandContext = new ActionExecutionContext( @@ -969,7 +969,7 @@ public class AmbariCustomCommandExecutionHelper { // Reset cluster host info as it has changed stage.setClusterHostInfo(clusterHostInfoJson); - Map<String, String> commandParams = new HashMap<String, String>(); + Map<String, String> commandParams = new HashMap<>(); if (serviceName.equals(Service.Type.HBASE.name())) { commandParams.put(DECOM_EXCLUDED_HOSTS, StringUtils.join(listOfExcludedHosts, ',')); if ((isDrainOnlyRequest != null) && isDrainOnlyRequest.equals("true")) { @@ -1066,7 +1066,7 @@ public class AmbariCustomCommandExecutionHelper { } else if (isValidCustomCommand(actionExecutionContext, resourceFilter)) { String commandDetail = getReadableCustomCommandDetail(actionExecutionContext, resourceFilter); - Map<String, String> extraParams = new HashMap<String, String>(); + Map<String, String> extraParams = new HashMap<>(); String componentName = (null == resourceFilter.getComponentName()) ? null : resourceFilter.getComponentName().toLowerCase(); @@ -1233,7 +1233,7 @@ public class AmbariCustomCommandExecutionHelper { Cluster cluster, StackId stackId) throws AmbariException { Map<String, String> commandParamsStage = StageUtils.getCommandParamsStage(actionExecContext); - Map<String, String> hostParamsStage = new HashMap<String, String>(); + Map<String, String> hostParamsStage = new HashMap<>(); Map<String, Set<String>> clusterHostInfo; String clusterHostInfoJson = "{}"; @@ -1254,7 +1254,7 @@ public class AmbariCustomCommandExecutionHelper { serviceName, componentName); List<String> clientsToUpdateConfigsList = componentInfo.getClientsToUpdateConfigs(); if (clientsToUpdateConfigsList == null) { - clientsToUpdateConfigsList = new ArrayList<String>(); + clientsToUpdateConfigsList = new ArrayList<>(); clientsToUpdateConfigsList.add("*"); } String clientsToUpdateConfigs = gson.toJson(clientsToUpdateConfigsList); @@ -1288,7 +1288,7 @@ public class AmbariCustomCommandExecutionHelper { } Map<String, String> createDefaultHostParams(Cluster cluster, StackId stackId) throws AmbariException{ - TreeMap<String, String> hostLevelParams = new TreeMap<String, String>(); + TreeMap<String, String> hostLevelParams = new TreeMap<>(); hostLevelParams.put(JDK_LOCATION, managementController.getJdkResourceUrl()); hostLevelParams.put(JAVA_HOME, managementController.getJavaHome()); hostLevelParams.put(JAVA_VERSION, String.valueOf(configs.getJavaVersion())); @@ -1427,7 +1427,7 @@ public class AmbariCustomCommandExecutionHelper { private Set<String> getUnhealthyHosts(Set<String> hosts, ActionExecutionContext actionExecutionContext, RequestResourceFilter resourceFilter) throws AmbariException { - Set<String> removedHosts = new HashSet<String>(); + Set<String> removedHosts = new HashSet<>(); for (String hostname : hosts) { if (filterUnhealthHostItem(hostname, actionExecutionContext, resourceFilter)){ removedHosts.add(hostname); http://git-wip-us.apache.org/repos/asf/ambari/blob/d540f943/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java index 9afe598..a6a56ed 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java @@ -176,7 +176,6 @@ import org.apache.ambari.server.state.ServiceComponentFactory; import org.apache.ambari.server.state.ServiceComponentHost; import org.apache.ambari.server.state.ServiceComponentHostEvent; import org.apache.ambari.server.state.ServiceComponentHostFactory; -import org.apache.ambari.server.state.ServiceFactory; import org.apache.ambari.server.state.ServiceInfo; import org.apache.ambari.server.state.ServiceOsSpecific; import org.apache.ambari.server.state.StackId; @@ -253,8 +252,6 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle private RoleCommandOrderProvider roleCommandOrderProvider; @Inject - private ServiceFactory serviceFactory; - @Inject private ServiceComponentFactory serviceComponentFactory; @Inject private ServiceComponentHostFactory serviceComponentHostFactory; @@ -301,10 +298,6 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle @Inject private ClusterVersionDAO clusterVersionDAO; @Inject - private AmbariEventPublisher ambariEventPublisher; - @Inject - private MetricsCollectorHAManager metricsCollectorHAManager; - @Inject private SettingDAO settingDAO; private MaintenanceStateHelper maintenanceStateHelper; @@ -519,8 +512,8 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle // do all validation checks Map<String, Map<String, Map<String, Set<String>>>> hostComponentNames = - new HashMap<String, Map<String, Map<String, Set<String>>>>(); - Set<String> duplicates = new HashSet<String>(); + new HashMap<>(); + Set<String> duplicates = new HashSet<>(); for (ServiceComponentHostRequest request : requests) { validateServiceComponentHostRequest(request); @@ -907,10 +900,10 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle Map<String, Config> configs = cluster.getConfigsByType( request.getType()); if (null == configs) { - configs = new HashMap<String, Config>(); + configs = new HashMap<>(); } - Map<String, Map<String, String>> propertiesAttributes = new HashMap<String, Map<String,String>>(); + Map<String, Map<String, String>> propertiesAttributes = new HashMap<>(); StackId currentStackId = cluster.getCurrentStackVersion(); StackInfo currentStackInfo = ambariMetaInfo.getStack(currentStackId.getStackName(), currentStackId.getStackVersion()); @@ -993,7 +986,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle @Override public Set<MemberResponse> getMembers(Set<MemberRequest> requests) throws AmbariException { - final Set<MemberResponse> responses = new HashSet<MemberResponse>(); + final Set<MemberResponse> responses = new HashSet<>(); for (MemberRequest request: requests) { LOG.debug("Received a getMembers request, " + request.toString()); final Group group = users.getGroup(request.getGroupName()); @@ -1025,7 +1018,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle } groupName = request.getGroupName(); } - final List<String> requiredMembers = new ArrayList<String>(); + final List<String> requiredMembers = new ArrayList<>(); for (MemberRequest request: requests) { if (request.getUserName() != null) { requiredMembers.add(request.getUserName()); @@ -1057,7 +1050,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle private Set<ClusterResponse> getClusters(ClusterRequest request) throws AmbariException, AuthorizationException { - Set<ClusterResponse> response = new HashSet<ClusterResponse>(); + Set<ClusterResponse> response = new HashSet<>(); if (LOG.isDebugEnabled()) { LOG.debug("Received a getClusters request" @@ -1193,7 +1186,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle } } - Set<Service> services = new HashSet<Service>(); + Set<Service> services = new HashSet<>(); if (request.getServiceName() != null && !request.getServiceName().isEmpty()) { services.add(cluster.getService(request.getServiceName())); } else { @@ -1201,7 +1194,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle } Set<ServiceComponentHostResponse> response = - new HashSet<ServiceComponentHostResponse>(); + new HashSet<>(); boolean checkDesiredState = false; State desiredStateToCheck = null; @@ -1237,7 +1230,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle for (Service s : services) { // filter on component name if provided - Set<ServiceComponent> components = new HashSet<ServiceComponent>(); + Set<ServiceComponent> components = new HashSet<>(); if (request.getComponentName() != null) { components.add(s.getServiceComponent(request.getComponentName())); } else { @@ -1402,7 +1395,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle Cluster cluster = clusters.getCluster(request.getClusterName()); - Set<ConfigurationResponse> responses = new HashSet<ConfigurationResponse>(); + Set<ConfigurationResponse> responses = new HashSet<>(); // !!! if only one, then we need full properties if (null != request.getType() && null != request.getVersionTag()) { @@ -1491,7 +1484,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle // kerberos_admin/principal // kerberos_admin/password if((sessionAttributes != null) && !sessionAttributes.isEmpty()) { - Map<String, Object> cleanedSessionAttributes = new HashMap<String, Object>(); + Map<String, Object> cleanedSessionAttributes = new HashMap<>(); String principal = null; char[] password = null; @@ -1562,7 +1555,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle //save data to return configurations created List<ConfigurationResponse> configurationResponses = - new LinkedList<ConfigurationResponse>(); + new LinkedList<>(); ServiceConfigVersionResponse serviceConfigVersionResponse = null; if (request.getDesiredConfig() != null && request.getServiceConfigVersionRequest() != null) { @@ -1667,7 +1660,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle List<ConfigurationRequest> desiredConfigs = request.getDesiredConfig(); if (!desiredConfigs.isEmpty()) { - Set<Config> configs = new HashSet<Config>(); + Set<Config> configs = new HashSet<>(); String note = null; for (ConfigurationRequest cr : desiredConfigs) { @@ -1796,7 +1789,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle new ClusterResponse(cluster.getClusterId(), cluster.getClusterName(), null, null, null, null, null, null); Map<String, Collection<ServiceConfigVersionResponse>> map = - new HashMap<String, Collection<ServiceConfigVersionResponse>>(); + new HashMap<>(); map.put(serviceConfigVersionResponse.getServiceName(), Collections.singletonList(serviceConfigVersionResponse)); clusterResponse.setDesiredServiceConfigVersions(map); @@ -1888,7 +1881,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle * @return a map lf property names to String arrays indicating the requsted changes ({current value, requested valiue}) */ private Map<String, String[]> getPropertyChanges(Cluster cluster, ConfigurationRequest request) { - Map<String, String[]> changedProperties = new HashMap<String, String[]>(); + Map<String, String[]> changedProperties = new HashMap<>(); // Ensure that the requested property map is not null. Map<String, String> requestedProperties = request.getProperties(); @@ -1905,7 +1898,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle } // Ensure all propery names are captured, including missing ones from either set. - Set<String> propertyNames = new HashSet<String>(); + Set<String> propertyNames = new HashSet<>(); propertyNames.addAll(requestedProperties.keySet()); propertyNames.addAll(existingProperties.keySet()); @@ -2003,7 +1996,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle // are not in a Maintenance state. Resource.Type opLvl = Resource.Type.Cluster; - Set<String> smokeTestServices = new HashSet<String>(); + Set<String> smokeTestServices = new HashSet<>(); // Adding smoke checks for changed services if (changedServices != null) { @@ -2022,7 +2015,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle // Adding smoke checks for changed host components Map<String, Map<String, Integer>> changedComponentCount = - new HashMap<String, Map<String, Integer>>(); + new HashMap<>(); for (Map<State, List<ServiceComponentHost>> stateScHostMap : changedScHosts.values()) { for (Entry<State, List<ServiceComponentHost>> entry : @@ -2092,7 +2085,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle Map<String, Map<State, List<ServiceComponentHost>>> changedScHosts) throws AmbariException { - Set<String> services = new HashSet<String>(); + Set<String> services = new HashSet<>(); // This is done to account for services with client only components. if (changedServices != null) { @@ -2109,7 +2102,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle } // Flatten changed Schs that are going to be Started - List<ServiceComponentHost> serviceComponentHosts = new ArrayList<ServiceComponentHost>(); + List<ServiceComponentHost> serviceComponentHosts = new ArrayList<>(); if (changedScHosts != null && !changedScHosts.isEmpty()) { for (Entry<String, Map<State, List<ServiceComponentHost>>> stringMapEntry : changedScHosts.entrySet()) { for (State state : stringMapEntry.getValue().keySet()) { @@ -2130,12 +2123,12 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle return; } - Map<String, List<ServiceComponentHost>> clientSchs = new HashMap<String, List<ServiceComponentHost>>(); + Map<String, List<ServiceComponentHost>> clientSchs = new HashMap<>(); for (String serviceName : services) { Service s = cluster.getService(serviceName); for (String component : s.getServiceComponents().keySet()) { - List<ServiceComponentHost> potentialHosts = new ArrayList<ServiceComponentHost>(); + List<ServiceComponentHost> potentialHosts = new ArrayList<>(); ServiceComponent sc = s.getServiceComponents().get(component); if (sc.isClientComponent()) { for (ServiceComponentHost potentialSch : sc.getServiceComponentHosts().values()) { @@ -2157,7 +2150,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle if (changedScHosts != null) { for (Entry<String, List<ServiceComponentHost>> stringListEntry : clientSchs.entrySet()) { - Map<State, List<ServiceComponentHost>> schMap = new EnumMap<State, List<ServiceComponentHost>>(State.class); + Map<State, List<ServiceComponentHost>> schMap = new EnumMap<>(State.class); schMap.put(State.INSTALLED, stringListEntry.getValue()); changedScHosts.put(stringListEntry.getKey(), schMap); } @@ -2238,7 +2231,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle execCmd.setConfigurationCredentials(configCredentials); // Create a local copy for each command - Map<String, String> commandParams = new TreeMap<String, String>(); + Map<String, String> commandParams = new TreeMap<>(); if (commandParamsInp != null) { // if not defined commandParams.putAll(commandParamsInp); } @@ -2350,8 +2343,6 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle commandParams.put(ExecutionCommand.KeyNames.REFRESH_TOPOLOGY, "True"); } - execCmd.setCommandParams(commandParams); - String repoInfo = customCommandExecutionHelper.getRepoInfo(cluster, host); if (LOG.isDebugEnabled()) { LOG.debug("Sending repo information to agent" @@ -2361,7 +2352,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle + ", repoInfo=" + repoInfo); } - Map<String, String> hostParams = new TreeMap<String, String>(); + Map<String, String> hostParams = new TreeMap<>(); hostParams.put(REPO_INFO, repoInfo); hostParams.putAll(getRcaParameters()); @@ -2422,7 +2413,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle List<String> clientsToUpdateConfigsList = componentInfo.getClientsToUpdateConfigs(); if (clientsToUpdateConfigsList == null) { - clientsToUpdateConfigsList = new ArrayList<String>(); + clientsToUpdateConfigsList = new ArrayList<>(); clientsToUpdateConfigsList.add("*"); } @@ -2430,16 +2421,18 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle hostParams.put(CLIENTS_TO_UPDATE_CONFIGS, clientsToUpdateConfigs); execCmd.setHostLevelParams(hostParams); - Map<String, String> roleParams = new TreeMap<String, String>(); + Map<String, String> roleParams = new TreeMap<>(); // !!! consistent with where custom commands put variables // !!! after-INSTALL hook checks this such that the stack selection tool won't // select-all to a version that is not being upgraded, breaking RU if (cluster.isUpgradeSuspended()) { - roleParams.put(KeyNames.UPGRADE_SUSPENDED, Boolean.TRUE.toString().toLowerCase()); + cluster.addSuspendedUpgradeParameters(commandParams, roleParams); } + execCmd.setRoleParams(roleParams); + execCmd.setCommandParams(commandParams); execCmd.setAvailableServicesFromServiceInfoMap(ambariMetaInfo.getServices(stackId.getStackName(), stackId.getStackVersion())); @@ -2489,7 +2482,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle // Build package list that is relevant for host List<ServiceOsSpecific.Package> packages = - new ArrayList<ServiceOsSpecific.Package>(); + new ArrayList<>(); if (anyOs != null) { packages.addAll(anyOs.getPackages()); } @@ -2502,7 +2495,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle } private List<ServiceOsSpecific> getOSSpecificsByFamily(Map<String, ServiceOsSpecific> osSpecifics, String osFamily) { - List<ServiceOsSpecific> foundedOSSpecifics = new ArrayList<ServiceOsSpecific>(); + List<ServiceOsSpecific> foundedOSSpecifics = new ArrayList<>(); for (Entry<String, ServiceOsSpecific> osSpecific : osSpecifics.entrySet()) { if (osSpecific.getKey().contains(osFamily)) { foundedOSSpecifics.add(osSpecific.getValue()); @@ -2675,14 +2668,14 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle // so kerberosHelper.configureServices know which to work on. Null indicates no filter // and all services and components will be (re)configured, however null will not be // passed in from here. - Map<String, Collection<String>> serviceFilter = new HashMap<String, Collection<String>>(); + Map<String, Collection<String>> serviceFilter = new HashMap<>(); for (ServiceComponentHost scHost : componentsToConfigureForKerberos) { String serviceName = scHost.getServiceName(); Collection<String> componentFilter = serviceFilter.get(serviceName); if (componentFilter == null) { - componentFilter = new HashSet<String>(); + componentFilter = new HashSet<>(); serviceFilter.put(serviceName, componentFilter); } @@ -2872,22 +2865,22 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle } if (null == requestParameters) { - requestParameters = new HashMap<String, String>(); + requestParameters = new HashMap<>(); } requestParameters.put(keyName, requestProperties.get(keyName)); } if (requestProperties.containsKey(CLUSTER_PHASE_PROPERTY)) { if (null == requestParameters) { - requestParameters = new HashMap<String, String>(); + requestParameters = new HashMap<>(); } requestParameters.put(CLUSTER_PHASE_PROPERTY, requestProperties.get(CLUSTER_PHASE_PROPERTY)); } - Map<String, Map<String, String>> configurations = new TreeMap<String, Map<String, String>>(); + Map<String, Map<String, String>> configurations = new TreeMap<>(); Map<String, Map<String, Map<String, String>>> configurationAttributes = - new TreeMap<String, Map<String, Map<String, String>>>(); + new TreeMap<>(); Host host = clusters.getHost(scHost.getHostName()); Map<String, Map<String, String>> configTags = @@ -2942,15 +2935,15 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle requestStages.addStages(rg.getStages()); if (!componentsToEnableKerberos.isEmpty()) { - Map<String, Collection<String>> serviceFilter = new HashMap<String, Collection<String>>(); - Set<String> hostFilter = new HashSet<String>(); + Map<String, Collection<String>> serviceFilter = new HashMap<>(); + Set<String> hostFilter = new HashSet<>(); for (ServiceComponentHost scHost : componentsToEnableKerberos) { String serviceName = scHost.getServiceName(); Collection<String> componentFilter = serviceFilter.get(serviceName); if (componentFilter == null) { - componentFilter = new HashSet<String>(); + componentFilter = new HashSet<>(); serviceFilter.put(serviceName, componentFilter); } @@ -3034,7 +3027,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle Map<String, Map<String, Map<String, String>>> configurationAttributes = - new TreeMap<String, Map<String, Map<String, String>>>(); + new TreeMap<>(); createHostAction(cluster, stage, scHost, configurations, configurationAttributes, configTags, roleCommand, null, null, false); @@ -3080,7 +3073,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle public Set<StackConfigurationDependencyResponse> getStackConfigurationDependencies( Set<StackConfigurationDependencyRequest> requests) throws AmbariException { Set<StackConfigurationDependencyResponse> response - = new HashSet<StackConfigurationDependencyResponse>(); + = new HashSet<>(); if (requests != null) { for (StackConfigurationDependencyRequest request : requests) { @@ -3106,7 +3099,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle private Set<StackConfigurationDependencyResponse> getStackConfigurationDependencies(StackConfigurationDependencyRequest request) throws AmbariException { Set<StackConfigurationDependencyResponse> response = - new HashSet<StackConfigurationDependencyResponse>(); + new HashSet<>(); String stackName = request.getStackName(); String stackVersion = request.getStackVersion(); @@ -3479,11 +3472,11 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle } //Clear exclud file or draining list except HBASE if (!serviceName.equals(Service.Type.HBASE.toString())) { - HashMap<String, String> requestProperties = new HashMap<String, String>(); + HashMap<String, String> requestProperties = new HashMap<>(); requestProperties.put("context", "Remove host " + included_hostname + " from exclude file"); requestProperties.put("exclusive", "true"); - HashMap<String, String> params = new HashMap<String, String>(); + HashMap<String, String> params = new HashMap<>(); params.put("included_hosts", included_hostname); params.put("slave_type", slave_component_name); params.put(AmbariCustomCommandExecutionHelper.UPDATE_EXCLUDE_FILE_ONLY, "true"); @@ -3558,7 +3551,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle actionManager.getRequestTasks(requestId); response.setRequestContext(actionManager.getRequestContext(requestId)); - List<ShortTaskStatus> tasks = new ArrayList<ShortTaskStatus>(); + List<ShortTaskStatus> tasks = new ArrayList<>(); for (HostRoleCommand hostRoleCommand : hostRoleCommands) { tasks.add(new ShortTaskStatus(hostRoleCommand)); @@ -3570,7 +3563,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle @Override public Set<ClusterResponse> getClusters(Set<ClusterRequest> requests) throws AmbariException, AuthorizationException { - Set<ClusterResponse> response = new HashSet<ClusterResponse>(); + Set<ClusterResponse> response = new HashSet<>(); for (ClusterRequest request : requests) { try { response.addAll(getClusters(request)); @@ -3590,7 +3583,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle Set<ServiceComponentHostRequest> requests) throws AmbariException { LOG.debug("Processing requests: {}", requests); Set<ServiceComponentHostResponse> response = - new HashSet<ServiceComponentHostResponse>(); + new HashSet<>(); for (ServiceComponentHostRequest request : requests) { try { response.addAll(getHostComponents(request)); @@ -3651,7 +3644,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle public Set<ConfigurationResponse> getConfigurations( Set<ConfigurationRequest> requests) throws AmbariException { Set<ConfigurationResponse> response = - new HashSet<ConfigurationResponse>(); + new HashSet<>(); for (ConfigurationRequest request : requests) { response.addAll(getConfigurations(request)); } @@ -3661,7 +3654,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle @Override public Set<ServiceConfigVersionResponse> getServiceConfigVersions(Set<ServiceConfigVersionRequest> requests) throws AmbariException { - Set<ServiceConfigVersionResponse> responses = new LinkedHashSet<ServiceConfigVersionResponse>(); + Set<ServiceConfigVersionResponse> responses = new LinkedHashSet<>(); for (ServiceConfigVersionRequest request : requests) { responses.addAll(getServiceConfigVersions(request)); @@ -3679,9 +3672,9 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle Cluster cluster = clusters.getCluster(request.getClusterName()); - Set<ServiceConfigVersionResponse> result = new LinkedHashSet<ServiceConfigVersionResponse>(); + Set<ServiceConfigVersionResponse> result = new LinkedHashSet<>(); String serviceName = request.getServiceName(); - List<ServiceConfigVersionResponse> serviceConfigVersionResponses = new ArrayList<ServiceConfigVersionResponse>(); + List<ServiceConfigVersionResponse> serviceConfigVersionResponses = new ArrayList<>(); if (Boolean.TRUE.equals(request.getIsCurrent()) && serviceName != null) { serviceConfigVersionResponses.addAll(cluster.getActiveServiceConfigVersionResponse(serviceName)); @@ -3709,7 +3702,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle public Set<UserResponse> getUsers(Set<UserRequest> requests) throws AmbariException, AuthorizationException { - Set<UserResponse> responses = new HashSet<UserResponse>(); + Set<UserResponse> responses = new HashSet<>(); for (UserRequest r : requests) { @@ -3739,7 +3732,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle for (User u : users.getAllUsers()) { UserResponse resp = new UserResponse(u.getUserName(), u.getUserType(), u.isLdapUser(), u.isActive(), u .isAdmin()); - resp.setGroups(new HashSet<String>(u.getGroups())); + resp.setGroups(new HashSet<>(u.getGroups())); responses.add(resp); } } else { @@ -3755,7 +3748,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle } else { UserResponse resp = new UserResponse(u.getUserName(), u.getUserType(), u.isLdapUser(), u.isActive(), u .isAdmin()); - resp.setGroups(new HashSet<String>(u.getGroups())); + resp.setGroups(new HashSet<>(u.getGroups())); responses.add(resp); } } @@ -3767,7 +3760,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle @Override public Set<GroupResponse> getGroups(Set<GroupRequest> requests) throws AmbariException { - final Set<GroupResponse> responses = new HashSet<GroupResponse>(); + final Set<GroupResponse> responses = new HashSet<>(); for (GroupRequest request: requests) { LOG.debug("Received a getGroups request, groupRequest=" + request.toString()); // get them all @@ -4039,7 +4032,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle @Override public Set<StackResponse> getStacks(Set<StackRequest> requests) throws AmbariException { - Set<StackResponse> response = new HashSet<StackResponse>(); + Set<StackResponse> response = new HashSet<>(); for (StackRequest request : requests) { try { response.addAll(getStacks(request)); @@ -4068,7 +4061,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle response = Collections.singleton(new StackResponse(stackName)); } else { Collection<StackInfo> supportedStacks = ambariMetaInfo.getStacks(); - response = new HashSet<StackResponse>(); + response = new HashSet<>(); for (StackInfo stack: supportedStacks) { response.add(new StackResponse(stack.getName())); } @@ -4094,7 +4087,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle @Override public Set<ExtensionResponse> getExtensions(Set<ExtensionRequest> requests) throws AmbariException { - Set<ExtensionResponse> response = new HashSet<ExtensionResponse>(); + Set<ExtensionResponse> response = new HashSet<>(); for (ExtensionRequest request : requests) { try { response.addAll(getExtensions(request)); @@ -4123,7 +4116,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle response = Collections.singleton(new ExtensionResponse(extensionName)); } else { Collection<ExtensionInfo> supportedExtensions = ambariMetaInfo.getExtensions(); - response = new HashSet<ExtensionResponse>(); + response = new HashSet<>(); for (ExtensionInfo extension: supportedExtensions) { response.add(new ExtensionResponse(extension.getName())); } @@ -4134,7 +4127,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle @Override public Set<ExtensionVersionResponse> getExtensionVersions( Set<ExtensionVersionRequest> requests) throws AmbariException { - Set<ExtensionVersionResponse> response = new HashSet<ExtensionVersionResponse>(); + Set<ExtensionVersionResponse> response = new HashSet<>(); for (ExtensionVersionRequest request : requests) { String extensionName = request.getExtensionName(); try { @@ -4167,7 +4160,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle } else { try { Collection<ExtensionInfo> extensionInfos = ambariMetaInfo.getExtensions(extensionName); - response = new HashSet<ExtensionVersionResponse>(); + response = new HashSet<>(); for (ExtensionInfo extensionInfo: extensionInfos) { response.add(extensionInfo.convertToResponse()); } @@ -4182,7 +4175,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle @Override public Set<RepositoryResponse> getRepositories(Set<RepositoryRequest> requests) throws AmbariException { - Set<RepositoryResponse> response = new HashSet<RepositoryResponse>(); + Set<RepositoryResponse> response = new HashSet<>(); for (RepositoryRequest request : requests) { try { String stackName = request.getStackName(); @@ -4230,7 +4223,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle } } - Set<RepositoryResponse> responses = new HashSet<RepositoryResponse>(); + Set<RepositoryResponse> responses = new HashSet<>(); if (repositoryVersionId != null) { final RepositoryVersionEntity repositoryVersion = repositoryVersionDAO.findByPK(repositoryVersionId); @@ -4411,7 +4404,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle @Override public Set<StackVersionResponse> getStackVersions( Set<StackVersionRequest> requests) throws AmbariException { - Set<StackVersionResponse> response = new HashSet<StackVersionResponse>(); + Set<StackVersionResponse> response = new HashSet<>(); for (StackVersionRequest request : requests) { String stackName = request.getStackName(); try { @@ -4445,7 +4438,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle } else { try { Collection<StackInfo> stackInfos = ambariMetaInfo.getStacks(stackName); - response = new HashSet<StackVersionResponse>(); + response = new HashSet<>(); for (StackInfo stackInfo: stackInfos) { response.add(stackInfo.convertToResponse()); } @@ -4461,7 +4454,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle public Set<StackServiceResponse> getStackServices( Set<StackServiceRequest> requests) throws AmbariException { - Set<StackServiceResponse> response = new HashSet<StackServiceResponse>(); + Set<StackServiceResponse> response = new HashSet<>(); for (StackServiceRequest request : requests) { String stackName = request.getStackName(); @@ -4500,7 +4493,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle response = Collections.singleton(new StackServiceResponse(service)); } else { Map<String, ServiceInfo> services = ambariMetaInfo.getServices(stackName, stackVersion); - response = new HashSet<StackServiceResponse>(); + response = new HashSet<>(); for (ServiceInfo service : services.values()) { response.add(new StackServiceResponse(service)); } @@ -4511,7 +4504,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle @Override public Set<StackConfigurationResponse> getStackLevelConfigurations( Set<StackLevelConfigurationRequest> requests) throws AmbariException { - Set<StackConfigurationResponse> response = new HashSet<StackConfigurationResponse>(); + Set<StackConfigurationResponse> response = new HashSet<>(); for (StackLevelConfigurationRequest request : requests) { String stackName = request.getStackName(); @@ -4533,7 +4526,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle private Set<StackConfigurationResponse> getStackLevelConfigurations( StackLevelConfigurationRequest request) throws AmbariException { - Set<StackConfigurationResponse> response = new HashSet<StackConfigurationResponse>(); + Set<StackConfigurationResponse> response = new HashSet<>(); String stackName = request.getStackName(); String stackVersion = request.getStackVersion(); @@ -4555,7 +4548,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle @Override public Set<StackConfigurationResponse> getStackConfigurations( Set<StackConfigurationRequest> requests) throws AmbariException { - Set<StackConfigurationResponse> response = new HashSet<StackConfigurationResponse>(); + Set<StackConfigurationResponse> response = new HashSet<>(); for (StackConfigurationRequest request : requests) { String stackName = request.getStackName(); @@ -4579,7 +4572,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle private Set<StackConfigurationResponse> getStackConfigurations( StackConfigurationRequest request) throws AmbariException { - Set<StackConfigurationResponse> response = new HashSet<StackConfigurationResponse>(); + Set<StackConfigurationResponse> response = new HashSet<>(); String stackName = request.getStackName(); String stackVersion = request.getStackVersion(); @@ -4602,7 +4595,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle @Override public Set<StackServiceComponentResponse> getStackComponents( Set<StackServiceComponentRequest> requests) throws AmbariException { - Set<StackServiceComponentResponse> response = new HashSet<StackServiceComponentResponse>(); + Set<StackServiceComponentResponse> response = new HashSet<>(); for (StackServiceComponentRequest request : requests) { String stackName = request.getStackName(); String stackVersion = request.getStackVersion(); @@ -4646,7 +4639,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle } else { List<ComponentInfo> components = ambariMetaInfo.getComponentsByService(stackName, stackVersion, serviceName); - response = new HashSet<StackServiceComponentResponse>(); + response = new HashSet<>(); for (ComponentInfo component: components) { response.add(new StackServiceComponentResponse(component)); @@ -4658,7 +4651,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle @Override public Set<OperatingSystemResponse> getOperatingSystems( Set<OperatingSystemRequest> requests) throws AmbariException { - Set<OperatingSystemResponse> response = new HashSet<OperatingSystemResponse>(); + Set<OperatingSystemResponse> response = new HashSet<>(); for (OperatingSystemRequest request : requests) { try { String stackName = request.getStackName(); @@ -4689,7 +4682,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle private Set<OperatingSystemResponse> getOperatingSystems( OperatingSystemRequest request) throws AmbariException { - Set<OperatingSystemResponse> responses = new HashSet<OperatingSystemResponse>(); + Set<OperatingSystemResponse> responses = new HashSet<>(); String stackName = request.getStackName(); String stackVersion = request.getStackVersion(); @@ -4767,7 +4760,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle @Override public Set<RootServiceResponse> getRootServices( Set<RootServiceRequest> requests) throws AmbariException { - Set<RootServiceResponse> response = new HashSet<RootServiceResponse>(); + Set<RootServiceResponse> response = new HashSet<>(); for (RootServiceRequest request : requests) { try { response.addAll(getRootServices(request)); @@ -4790,7 +4783,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle @Override public Set<RootServiceComponentResponse> getRootServiceComponents( Set<RootServiceComponentRequest> requests) throws AmbariException { - Set<RootServiceComponentResponse> response = new HashSet<RootServiceComponentResponse>(); + Set<RootServiceComponentResponse> response = new HashSet<>(); for (RootServiceComponentRequest request : requests) { String serviceName = request.getServiceName(); try { @@ -4905,7 +4898,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle hostsMap.getHostMap(hostName)); } - Map<String, String> rcaParameters = new HashMap<String, String>(); + Map<String, String> rcaParameters = new HashMap<>(); rcaParameters.put(AMBARI_DB_RCA_URL, url); rcaParameters.put(AMBARI_DB_RCA_DRIVER, configs.getRcaDatabaseDriver()); @@ -5088,7 +5081,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle layoutEntity.setScope(WidgetLayoutResourceProvider.SCOPE.CLUSTER.name()); layoutEntity.setUserName(user); - List<WidgetLayoutUserWidgetEntity> widgetLayoutUserWidgetEntityList = new LinkedList<WidgetLayoutUserWidgetEntity>(); + List<WidgetLayoutUserWidgetEntity> widgetLayoutUserWidgetEntityList = new LinkedList<>(); int order = 0; for (WidgetLayoutInfo layoutInfo : widgetLayout.getWidgetLayoutInfoList()) { if (layoutInfo.getDefaultSectionName() == null) { @@ -5119,7 +5112,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle // Add new widgets to end of the existing ones List<WidgetLayoutUserWidgetEntity> layoutUserWidgetEntities = existingLayoutEntity.getListWidgetLayoutUserWidgetEntity(); if (layoutUserWidgetEntities == null) { - layoutUserWidgetEntities = new LinkedList<WidgetLayoutUserWidgetEntity>(); + layoutUserWidgetEntities = new LinkedList<>(); existingLayoutEntity.setListWidgetLayoutUserWidgetEntity(layoutUserWidgetEntities); } int order = layoutUserWidgetEntities.size() - 1; @@ -5196,7 +5189,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle * @return a map of properties */ public Map<String,String> getCredentialStoreServiceProperties() { - Map<String,String> properties = new HashMap<String, String>(); + Map<String,String> properties = new HashMap<>(); properties.put("storage.persistent", String.valueOf(credentialStoreService.isInitialized(CredentialStoreType.PERSISTED))); properties.put("storage.temporary", String.valueOf(credentialStoreService.isInitialized(CredentialStoreType.TEMPORARY))); return properties; @@ -5235,7 +5228,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle Map<PropertyInfo.PropertyType, Set<String>> propertyTypes = cluster.getConfigPropertiesTypes(configType); // Create a composite set of properties to check... - Set<String> propertiesToCheck = new HashSet<String>(); + Set<String> propertiesToCheck = new HashSet<>(); Set<String> userProperties = propertyTypes.get(PropertyType.USER); if (userProperties != null) { @@ -5330,10 +5323,10 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle Map<String, String[]> relevantPropertyChanges; // If necessary remove any non-relevant property changes. - if (relevantChangesToIgnore == null) + if (relevantChangesToIgnore == null) { relevantPropertyChanges = propertyChanges; - else { - relevantPropertyChanges = new HashMap<String, String[]>(propertyChanges); + } else { + relevantPropertyChanges = new HashMap<>(propertyChanges); for (String propertyName : relevantChangesToIgnore) { relevantPropertyChanges.remove(propertyName); http://git-wip-us.apache.org/repos/asf/ambari/blob/d540f943/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java index 2ec43cf..9ecb774 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java @@ -19,7 +19,6 @@ package org.apache.ambari.server.controller.internal; import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.HOOKS_FOLDER; import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.SERVICE_PACKAGE_FOLDER; -import static org.apache.ambari.server.agent.ExecutionCommand.KeyNames.VERSION; import java.text.MessageFormat; import java.util.ArrayList; @@ -128,7 +127,6 @@ import com.google.common.collect.Lists; import com.google.common.collect.Sets; import com.google.gson.Gson; import com.google.gson.JsonArray; -import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.inject.Inject; import com.google.inject.Provider; @@ -221,30 +219,6 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider Arrays.asList(UPGRADE_REQUEST_ID, UPGRADE_CLUSTER_NAME)); private static final Set<String> PROPERTY_IDS = new HashSet<>(); - private static final String COMMAND_PARAM_VERSION = VERSION; - private static final String COMMAND_PARAM_CLUSTER_NAME = "clusterName"; - private static final String COMMAND_PARAM_DIRECTION = "upgrade_direction"; - private static final String COMMAND_PARAM_UPGRADE_PACK = "upgrade_pack"; - private static final String COMMAND_PARAM_REQUEST_ID = "request_id"; - - private static final String COMMAND_PARAM_UPGRADE_TYPE = "upgrade_type"; - private static final String COMMAND_PARAM_TASKS = "tasks"; - private static final String COMMAND_PARAM_STRUCT_OUT = "structured_out"; - private static final String COMMAND_DOWNGRADE_FROM_VERSION = "downgrade_from_version"; - - /** - * The original "current" stack of the cluster before the upgrade started. - * This is the same regardless of whether the current direction is - * {@link Direction#UPGRADE} or {@link Direction#DOWNGRADE}. - */ - private static final String COMMAND_PARAM_ORIGINAL_STACK = "original_stack"; - - /** - * The target upgrade stack before the upgrade started. This is the same - * regardless of whether the current direction is {@link Direction#UPGRADE} or - * {@link Direction#DOWNGRADE}. - */ - private static final String COMMAND_PARAM_TARGET_STACK = "target_stack"; private static final String DEFAULT_REASON_TEMPLATE = "Aborting upgrade %s"; @@ -395,8 +369,11 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider } } + // the version being upgraded or downgraded to (ie 2.2.1.0-1234) + final String version = (String) requestMap.get(UPGRADE_VERSION); + final UpgradeContext upgradeContext = s_upgradeContextFactory.create(cluster, upgradeType, - direction, requestMap); + direction, version, requestMap); UpgradePack upgradePack = validateRequest(upgradeContext); upgradeContext.setUpgradePack(upgradePack); @@ -431,7 +408,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider public Set<Resource> getResources(Request request, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { - Set<Resource> results = new HashSet<Resource>(); + Set<Resource> results = new HashSet<>(); Set<String> requestPropertyIds = getRequestPropertyIds(request, predicate); for (Map<String, Object> propertyMap : getPropertyMaps(predicate)) { @@ -450,7 +427,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider String.format("Cluster %s could not be loaded", clusterName)); } - List<UpgradeEntity> upgrades = new ArrayList<UpgradeEntity>(); + List<UpgradeEntity> upgrades = new ArrayList<>(); String upgradeIdStr = (String) propertyMap.get(UPGRADE_REQUEST_ID); if (null != upgradeIdStr) { @@ -728,7 +705,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider String userName = getManagementController().getAuthName(); // the version being upgraded or downgraded to (ie 2.2.1.0-1234) - final String version = (String) requestMap.get(UPGRADE_VERSION); + final String version = upgradeContext.getVersion(); MasterHostResolver resolver = null; if (direction.isUpgrade()) { @@ -737,34 +714,10 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider resolver = new MasterHostResolver(configHelper, cluster, version); } - StackId sourceStackId = null; - StackId targetStackId = null; - Set<String> supportedServices = new HashSet<>(); UpgradeScope scope = UpgradeScope.COMPLETE; - switch (direction) { - case UPGRADE: - sourceStackId = cluster.getCurrentStackVersion(); - - RepositoryVersionEntity targetRepositoryVersion = s_repoVersionDAO.findByStackNameAndVersion( - sourceStackId.getStackName(), version); - - // !!! TODO check the repo_version for patch-ness and restrict the context - // to those services that require it. Consult the version definition and add the - // service names to supportedServices - - targetStackId = targetRepositoryVersion.getStackId(); - break; - case DOWNGRADE: - sourceStackId = cluster.getCurrentStackVersion(); - targetStackId = cluster.getDesiredStackVersion(); - break; - } - upgradeContext.setResolver(resolver); - upgradeContext.setSourceAndTargetStacks(sourceStackId, targetStackId); - upgradeContext.setVersion(version); upgradeContext.setSupportedServices(supportedServices); upgradeContext.setScope(scope); @@ -835,6 +788,10 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider List<UpgradeGroupEntity> groupEntities = new ArrayList<>(); RequestStageContainer req = createRequest(direction, version); + // the upgrade context calculated these for us based on direction + StackId sourceStackId = upgradeContext.getOriginalStackId(); + StackId targetStackId = upgradeContext.getTargetStackId(); + /** During a Rolling Upgrade, change the desired Stack Id if jumping across major stack versions (e.g., HDP 2.2 -> 2.3), and then set config changes @@ -1087,9 +1044,9 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider // We want to skip updating config-types of services that are not in the upgrade pack. // Care should be taken as some config-types could be in services that are in and out // of the upgrade pack. We should never ignore config-types of services in upgrade pack. - Set<String> skipConfigTypes = new HashSet<String>(); - Set<String> upgradePackServices = new HashSet<String>(); - Set<String> upgradePackConfigTypes = new HashSet<String>(); + Set<String> skipConfigTypes = new HashSet<>(); + Set<String> upgradePackServices = new HashSet<>(); + Set<String> upgradePackConfigTypes = new HashSet<>(); AmbariMetaInfo ambariMetaInfo = s_metaProvider.get(); Map<String, ServiceInfo> stackServicesMap = ambariMetaInfo.getServices(targetStack.getStackName(), targetStack.getStackVersion()); for (Grouping group : upgradePack.getGroups(direction)) { @@ -1111,7 +1068,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider } } } - Set<String> servicesNotInUpgradePack = new HashSet<String>(stackServicesMap.keySet()); + Set<String> servicesNotInUpgradePack = new HashSet<>(stackServicesMap.keySet()); servicesNotInUpgradePack.removeAll(upgradePackServices); for (String serviceNotInUpgradePack : servicesNotInUpgradePack) { ServiceInfo serviceInfo = stackServicesMap.get(serviceNotInUpgradePack); @@ -1321,16 +1278,11 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider // add each host to this stage RequestResourceFilter filter = new RequestResourceFilter("", "", - new ArrayList<String>(wrapper.getHosts())); + new ArrayList<>(wrapper.getHosts())); LOG.debug("Analyzing upgrade item {} with tasks: {}.", entity.getText(), entity.getTasks()); - Map<String, String> params = getNewParameterMap(request); - params.put(COMMAND_PARAM_TASKS, entity.getTasks()); - params.put(COMMAND_PARAM_VERSION, context.getVersion()); - params.put(COMMAND_PARAM_DIRECTION, context.getDirection().name().toLowerCase()); - params.put(COMMAND_PARAM_ORIGINAL_STACK, context.getOriginalStackId().getStackId()); - params.put(COMMAND_PARAM_TARGET_STACK, context.getTargetStackId().getStackId()); - params.put(COMMAND_DOWNGRADE_FROM_VERSION, context.getDowngradeFromVersion()); + Map<String, String> params = getNewParameterMap(request, context); + params.put(UpgradeContext.COMMAND_PARAM_TASKS, entity.getTasks()); // Apply additional parameters to the command that come from the stage. applyAdditionalParameters(wrapper, params); @@ -1411,12 +1363,12 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider Cluster cluster = context.getCluster(); - List<RequestResourceFilter> filters = new ArrayList<RequestResourceFilter>(); + List<RequestResourceFilter> filters = new ArrayList<>(); for (TaskWrapper tw : wrapper.getTasks()) { // add each host to this stage filters.add(new RequestResourceFilter(tw.getService(), tw.getComponent(), - new ArrayList<String>(tw.getHosts()))); + new ArrayList<>(tw.getHosts()))); } String function = null; @@ -1432,20 +1384,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider break; } - Map<String, String> commandParams = getNewParameterMap(request); - if (null != context.getType()) { - // use the serialized attributes of the enum to convert it to a string, - // but first we must convert it into an element so that we don't get a - // quoted string - using toString() actually returns a quoted stirng which is bad - JsonElement json = s_gson.toJsonTree(context.getType()); - commandParams.put(COMMAND_PARAM_UPGRADE_TYPE, json.getAsString()); - } - - commandParams.put(COMMAND_PARAM_VERSION, context.getVersion()); - commandParams.put(COMMAND_PARAM_DIRECTION, context.getDirection().name().toLowerCase()); - commandParams.put(COMMAND_PARAM_ORIGINAL_STACK, context.getOriginalStackId().getStackId()); - commandParams.put(COMMAND_PARAM_TARGET_STACK, context.getTargetStackId().getStackId()); - commandParams.put(COMMAND_DOWNGRADE_FROM_VERSION, context.getDowngradeFromVersion()); + Map<String, String> commandParams = getNewParameterMap(request, context); // Apply additional parameters to the command that come from the stage. applyAdditionalParameters(wrapper, commandParams); @@ -1478,7 +1417,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider stage.setStageId(stageId); entity.setStageId(Long.valueOf(stageId)); - Map<String, String> requestParams = new HashMap<String, String>(); + Map<String, String> requestParams = new HashMap<>(); requestParams.put("command", function); // !!! it is unclear the implications of this on rolling or express upgrade. To turn @@ -1496,7 +1435,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider boolean supportsAutoSkipOnFailure, boolean allowRetry) throws AmbariException { - List<RequestResourceFilter> filters = new ArrayList<RequestResourceFilter>(); + List<RequestResourceFilter> filters = new ArrayList<>(); for (TaskWrapper tw : wrapper.getTasks()) { filters.add(new RequestResourceFilter(tw.getService(), "", Collections.<String> emptyList())); @@ -1504,12 +1443,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider Cluster cluster = context.getCluster(); - Map<String, String> commandParams = getNewParameterMap(request); - commandParams.put(COMMAND_PARAM_VERSION, context.getVersion()); - commandParams.put(COMMAND_PARAM_DIRECTION, context.getDirection().name().toLowerCase()); - commandParams.put(COMMAND_PARAM_ORIGINAL_STACK, context.getOriginalStackId().getStackId()); - commandParams.put(COMMAND_PARAM_TARGET_STACK, context.getTargetStackId().getStackId()); - commandParams.put(COMMAND_DOWNGRADE_FROM_VERSION, context.getDowngradeFromVersion()); + Map<String, String> commandParams = getNewParameterMap(request, context); // Apply additional parameters to the command that come from the stage. applyAdditionalParameters(wrapper, commandParams); @@ -1544,7 +1478,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider stage.setStageId(stageId); entity.setStageId(Long.valueOf(stageId)); - Map<String, String> requestParams = getNewParameterMap(request); + Map<String, String> requestParams = getNewParameterMap(request, context); s_commandExecutionHelper.get().addExecutionCommandsToStage(actionContext, stage, requestParams); request.addStages(Collections.singletonList(stage)); @@ -1571,14 +1505,8 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider Cluster cluster = context.getCluster(); - Map<String, String> commandParams = getNewParameterMap(request); - commandParams.put(COMMAND_PARAM_CLUSTER_NAME, cluster.getClusterName()); - commandParams.put(COMMAND_PARAM_VERSION, context.getVersion()); - commandParams.put(COMMAND_PARAM_DIRECTION, context.getDirection().name().toLowerCase()); - commandParams.put(COMMAND_PARAM_ORIGINAL_STACK, context.getOriginalStackId().getStackId()); - commandParams.put(COMMAND_PARAM_TARGET_STACK, context.getTargetStackId().getStackId()); - commandParams.put(COMMAND_DOWNGRADE_FROM_VERSION, context.getDowngradeFromVersion()); - commandParams.put(COMMAND_PARAM_UPGRADE_PACK, upgradePack.getName()); + Map<String, String> commandParams = getNewParameterMap(request, context); + commandParams.put(UpgradeContext.COMMAND_PARAM_UPGRADE_PACK, upgradePack.getName()); // Notice that this does not apply any params because the input does not specify a stage. // All of the other actions do use additional params. @@ -1599,7 +1527,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider ManualTask mt = (ManualTask) task; if (StringUtils.isNotBlank(mt.structuredOut)) { - commandParams.put(COMMAND_PARAM_STRUCT_OUT, mt.structuredOut); + commandParams.put(UpgradeContext.COMMAND_PARAM_STRUCT_OUT, mt.structuredOut); } } @@ -1691,9 +1619,16 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider } /** - * Gets a map initialized with parameters required for rolling uprgades to - * work. The following properties are already set: + * Gets a map initialized with parameters required for upgrades to work. The + * following properties are already set: * <ul> + * <li>{@link UpgradeContext#COMMAND_PARAM_CLUSTER_NAME} + * <li>{@link UpgradeContext#COMMAND_PARAM_VERSION} + * <li>{@link UpgradeContext#COMMAND_PARAM_DIRECTION} + * <li>{@link UpgradeContext#COMMAND_PARAM_ORIGINAL_STACK} + * <li>{@link UpgradeContext#COMMAND_PARAM_TARGET_STACK} + * <li>{@link UpgradeContext#COMMAND_DOWNGRADE_FROM_VERSION} + * <li>{@link UpgradeContext#COMMAND_PARAM_UPGRADE_TYPE} * <li>{@link KeyNames#REFRESH_CONFIG_TAGS_BEFORE_EXECUTION} - necessary in * order to have the commands contain the correct configurations. Otherwise, * they will contain the configurations that were available at the time the @@ -1703,12 +1638,13 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider * <li>{@link #COMMAND_PARAM_REQUEST_ID}</li> the ID of the request. * <ul> * - * @return + * @return the initialized parameter map. */ - private Map<String, String> getNewParameterMap(RequestStageContainer requestStageContainer) { - Map<String, String> parameters = new HashMap<String, String>(); - parameters.put(KeyNames.REFRESH_CONFIG_TAGS_BEFORE_EXECUTION, "true"); - parameters.put(COMMAND_PARAM_REQUEST_ID, String.valueOf(requestStageContainer.getId())); + private Map<String, String> getNewParameterMap(RequestStageContainer requestStageContainer, + UpgradeContext context) { + Map<String, String> parameters = context.getInitializedCommandParameters(); + parameters.put(UpgradeContext.COMMAND_PARAM_REQUEST_ID, + String.valueOf(requestStageContainer.getId())); return parameters; } @@ -1776,7 +1712,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider } } else { // Status must be PENDING. - List<Long> taskIds = new ArrayList<Long>(); + List<Long> taskIds = new ArrayList<>(); List<HostRoleCommandEntity> hrcEntities = s_hostRoleCommandDAO.findByRequestIdAndStatuses( requestId, Sets.newHashSet(HostRoleStatus.ABORTED, HostRoleStatus.TIMEDOUT)); @@ -2079,7 +2015,7 @@ public class UpgradeResourceProvider extends AbstractControllerResourceProvider direction.getText(false), e)); } - List<Resource> failedResources = new LinkedList<Resource>(); + List<Resource> failedResources = new LinkedList<>(); if (preUpgradeCheckResources != null) { for (Resource res : preUpgradeCheckResources) { PrereqCheckStatus prereqCheckStatus = (PrereqCheckStatus) res.getPropertyValue( http://git-wip-us.apache.org/repos/asf/ambari/blob/d540f943/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java b/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java index 4e37c92..8074b31 100644 --- a/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java +++ b/ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java @@ -746,4 +746,18 @@ public interface Cluster { * @return the role command order instance (not {@code null}). */ RoleCommandOrder getRoleCommandOrder(); + + /** + * Adds upgrade specific command and role parameters to the command maps if + * there is a suspended upgrade. If there is not a suspended upgrade, then the + * maps are not modified. + * <p/> + * + * @param commandParams + * the command parameter map to supplement (not {@code null}). + * @param roleParams + * the role parameter map to supplement (not {@code null}). + */ + void addSuspendedUpgradeParameters(Map<String, String> commandParams, + Map<String, String> roleParams); }