You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2014/10/16 22:11:30 UTC
[06/51] [partial] AMBARI-7718. Rebase branch-windows-dev against
trunk. (Jayush Luniya and Florian Barca via yusaku)
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterResponse.java
index e8a60c8..2c233e6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ClusterResponse.java
@@ -18,9 +18,12 @@
package org.apache.ambari.server.controller;
+import java.util.Collection;
+import java.util.List;
import java.util.Map;
import java.util.Set;
+import com.google.common.collect.Multimap;
import org.apache.ambari.server.state.DesiredConfig;
import org.apache.ambari.server.state.State;
import org.apache.ambari.server.state.ClusterHealthReport;
@@ -36,6 +39,8 @@ public class ClusterResponse {
private final String desiredStackVersion;
private Map<String, DesiredConfig> desiredConfigs;
+
+ private Map<String, Collection<ServiceConfigVersionResponse>> desiredServiceConfigVersions;
private String provisioningState;
@@ -177,4 +182,12 @@ public class ClusterResponse {
public ClusterHealthReport getClusterHealthReport() {
return clusterHealthReport;
}
+
+ public Map<String, Collection<ServiceConfigVersionResponse>> getDesiredServiceConfigVersions() {
+ return desiredServiceConfigVersions;
+ }
+
+ public void setDesiredServiceConfigVersions(Map<String, Collection<ServiceConfigVersionResponse>> desiredServiceConfigVersions) {
+ this.desiredServiceConfigVersions = desiredServiceConfigVersions;
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigGroupRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigGroupRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigGroupRequest.java
index 4c0d3a2..efa1a7e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigGroupRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigGroupRequest.java
@@ -29,6 +29,7 @@ public class ConfigGroupRequest {
private String groupName;
private String tag;
private String description;
+ private String serviceConfigVersionNote;
private Set<String> hosts;
private Map<String, Config> configs;
@@ -99,4 +100,12 @@ public class ConfigGroupRequest {
public void setId(Long id) {
this.id = id;
}
+
+ public String getServiceConfigVersionNote() {
+ return serviceConfigVersionNote;
+ }
+
+ public void setServiceConfigVersionNote(String serviceConfigVersionNote) {
+ this.serviceConfigVersionNote = serviceConfigVersionNote;
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java
index ba15afd..0e28a86 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationRequest.java
@@ -30,9 +30,12 @@ public class ConfigurationRequest {
private String clusterName;
private String type;
private String tag;
+ private Long version;
+ private String serviceConfigVersionNote;
private Map<String, String> configs;
private boolean selected = true;
private Map<String, Map<String, String>> configsAttributes;
+ private boolean includeProperties;
public ConfigurationRequest() {
configs = new HashMap<String, String>();
@@ -51,6 +54,7 @@ public class ConfigurationRequest {
this.tag = tag;
this.configs = configs;
this.configsAttributes = configsAttributes;
+ this.includeProperties = (type != null && tag != null);
}
/**
@@ -127,6 +131,24 @@ public class ConfigurationRequest {
}
/**
+ * Set whether properties should be included.
+ *
+ * @param includeProperties whether properties should be included
+ */
+ public void setIncludeProperties(boolean includeProperties) {
+ this.includeProperties = includeProperties;
+ }
+
+ /**
+ * Determine whether properties should be included.
+ *
+ * @return true if properties should be included; false otherwise
+ */
+ public boolean includeProperties() {
+ return this.includeProperties;
+ }
+
+ /**
* @return Attributes of configs
*/
public Map<String, Map<String, String>> getPropertiesAttributes() {
@@ -137,4 +159,20 @@ public class ConfigurationRequest {
Map<String, Map<String, String>> configsAttributes) {
this.configsAttributes = configsAttributes;
}
+
+ public Long getVersion() {
+ return version;
+ }
+
+ public void setVersion(Long version) {
+ this.version = version;
+ }
+
+ public String getServiceConfigVersionNote() {
+ return serviceConfigVersionNote;
+ }
+
+ public void setServiceConfigVersionNote(String serviceConfigVersionNote) {
+ this.serviceConfigVersionNote = serviceConfigVersionNote;
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationResponse.java
index 86b1a3a..dd5c667 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ConfigurationResponse.java
@@ -17,6 +17,7 @@
*/
package org.apache.ambari.server.controller;
+import java.util.List;
import java.util.Map;
/**
@@ -32,12 +33,17 @@ public class ConfigurationResponse {
private String versionTag;
+ private Long version;
+
+ private List<Long> serviceConfigVersions;
+
private Map<String, String> configs;
private Map<String, Map<String, String>> configAttributes;
public ConfigurationResponse(String clusterName,
String type, String versionTag,
+ Long version,
Map<String, String> configs,
Map<String, Map<String, String>> configAttributes) {
super();
@@ -45,6 +51,7 @@ public class ConfigurationResponse {
this.configs = configs;
this.type = type;
this.versionTag = versionTag;
+ this.version = version;
this.configs = configs;
this.configAttributes = configAttributes;
}
@@ -100,26 +107,24 @@ public class ConfigurationResponse {
return clusterName;
}
+ public Long getVersion() {
+ return version;
+ }
+
+ public void setVersion(Long version) {
+ this.version = version;
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
- ConfigurationResponse that =
- (ConfigurationResponse) o;
-
- if (clusterName != null ?
- !clusterName.equals(that.clusterName) : that.clusterName != null) {
- return false;
- }
- if (type != null ?
- !type.equals(that.type) : that.type != null) {
- return false;
- }
- if (versionTag != null ?
- !versionTag.equals(that.versionTag) : that.versionTag != null){
- return false;
- }
+ ConfigurationResponse that = (ConfigurationResponse) o;
+
+ if (clusterName != null ? !clusterName.equals(that.clusterName) : that.clusterName != null) return false;
+ if (type != null ? !type.equals(that.type) : that.type != null) return false;
+ if (version != null ? !version.equals(that.version) : that.version != null) return false;
return true;
}
@@ -127,9 +132,16 @@ public class ConfigurationResponse {
@Override
public int hashCode() {
int result = clusterName != null ? clusterName.hashCode() : 0;
- result = 71 * result + (type != null ? type.hashCode() : 0);
- result = 71 * result + (versionTag != null ? versionTag.hashCode():0);
+ result = 31 * result + (type != null ? type.hashCode() : 0);
+ result = 31 * result + (version != null ? version.hashCode() : 0);
return result;
}
+ public List<Long> getServiceConfigVersions() {
+ return serviceConfigVersions;
+ }
+
+ public void setServiceConfigVersions(List<Long> serviceConfigVersions) {
+ this.serviceConfigVersions = serviceConfigVersions;
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
index fc049a4..0974f6f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
@@ -18,15 +18,28 @@
package org.apache.ambari.server.controller;
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.google.inject.AbstractModule;
-import com.google.inject.Scopes;
-import com.google.inject.assistedinject.FactoryModuleBuilder;
-import com.google.inject.name.Names;
-import com.google.inject.persist.PersistModule;
-import com.google.inject.persist.jpa.AmbariJpaPersistModule;
+import static org.eclipse.persistence.config.PersistenceUnitProperties.CREATE_JDBC_DDL_FILE;
+import static org.eclipse.persistence.config.PersistenceUnitProperties.CREATE_ONLY;
+import static org.eclipse.persistence.config.PersistenceUnitProperties.CREATE_OR_EXTEND;
+import static org.eclipse.persistence.config.PersistenceUnitProperties.DDL_BOTH_GENERATION;
+import static org.eclipse.persistence.config.PersistenceUnitProperties.DDL_GENERATION;
+import static org.eclipse.persistence.config.PersistenceUnitProperties.DDL_GENERATION_MODE;
+import static org.eclipse.persistence.config.PersistenceUnitProperties.DROP_AND_CREATE;
+import static org.eclipse.persistence.config.PersistenceUnitProperties.DROP_JDBC_DDL_FILE;
+import static org.eclipse.persistence.config.PersistenceUnitProperties.JDBC_DRIVER;
+import static org.eclipse.persistence.config.PersistenceUnitProperties.JDBC_PASSWORD;
+import static org.eclipse.persistence.config.PersistenceUnitProperties.JDBC_URL;
+import static org.eclipse.persistence.config.PersistenceUnitProperties.JDBC_USER;
+import static org.eclipse.persistence.config.PersistenceUnitProperties.THROW_EXCEPTIONS;
+import java.security.SecureRandom;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.ambari.server.EagerSingleton;
import org.apache.ambari.server.actionmanager.ActionDBAccessor;
import org.apache.ambari.server.actionmanager.ActionDBAccessorImpl;
import org.apache.ambari.server.actionmanager.ExecutionCommandWrapper;
@@ -46,6 +59,8 @@ import org.apache.ambari.server.orm.DBAccessorImpl;
import org.apache.ambari.server.orm.PersistenceType;
import org.apache.ambari.server.scheduler.ExecutionScheduler;
import org.apache.ambari.server.scheduler.ExecutionSchedulerImpl;
+import org.apache.ambari.server.security.SecurityHelper;
+import org.apache.ambari.server.security.SecurityHelperImpl;
import org.apache.ambari.server.serveraction.ServerActionManager;
import org.apache.ambari.server.serveraction.ServerActionManagerImpl;
import org.apache.ambari.server.state.Cluster;
@@ -73,35 +88,42 @@ import org.apache.ambari.server.state.host.HostImpl;
import org.apache.ambari.server.state.scheduler.RequestExecution;
import org.apache.ambari.server.state.scheduler.RequestExecutionFactory;
import org.apache.ambari.server.state.scheduler.RequestExecutionImpl;
+import org.apache.ambari.server.state.services.AlertNoticeDispatchService;
+import org.apache.ambari.server.state.stack.OsFamily;
import org.apache.ambari.server.state.svccomphost.ServiceComponentHostImpl;
+import org.apache.ambari.server.view.ViewInstanceHandlerList;
+import org.eclipse.jetty.server.SessionIdManager;
+import org.eclipse.jetty.server.SessionManager;
+import org.eclipse.jetty.server.session.HashSessionIdManager;
+import org.eclipse.jetty.server.session.HashSessionManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.config.BeanDefinition;
+import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
+import org.springframework.core.type.filter.AnnotationTypeFilter;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.crypto.password.StandardPasswordEncoder;
+import org.springframework.util.ClassUtils;
+import org.springframework.web.filter.DelegatingFilterProxy;
-import java.security.SecureRandom;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Properties;
-
-import static org.eclipse.persistence.config.PersistenceUnitProperties.CREATE_JDBC_DDL_FILE;
-import static org.eclipse.persistence.config.PersistenceUnitProperties.CREATE_ONLY;
-import static org.eclipse.persistence.config.PersistenceUnitProperties.CREATE_OR_EXTEND;
-import static org.eclipse.persistence.config.PersistenceUnitProperties.DDL_BOTH_GENERATION;
-import static org.eclipse.persistence.config.PersistenceUnitProperties.DDL_GENERATION;
-import static org.eclipse.persistence.config.PersistenceUnitProperties.DDL_GENERATION_MODE;
-import static org.eclipse.persistence.config.PersistenceUnitProperties.DROP_AND_CREATE;
-import static org.eclipse.persistence.config.PersistenceUnitProperties.DROP_JDBC_DDL_FILE;
-import static org.eclipse.persistence.config.PersistenceUnitProperties.JDBC_DRIVER;
-import static org.eclipse.persistence.config.PersistenceUnitProperties.JDBC_PASSWORD;
-import static org.eclipse.persistence.config.PersistenceUnitProperties.JDBC_URL;
-import static org.eclipse.persistence.config.PersistenceUnitProperties.JDBC_USER;
-import static org.eclipse.persistence.config.PersistenceUnitProperties.THROW_EXCEPTIONS;
+import com.google.common.util.concurrent.ServiceManager;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.inject.AbstractModule;
+import com.google.inject.Scopes;
+import com.google.inject.assistedinject.FactoryModuleBuilder;
+import com.google.inject.name.Names;
+import com.google.inject.persist.PersistModule;
+import com.google.inject.persist.jpa.AmbariJpaPersistModule;
/**
* Used for injection purposes.
*/
public class ControllerModule extends AbstractModule {
+ private static Logger LOG = LoggerFactory.getLogger(ControllerModule.class);
private final Configuration configuration;
+ private final OsFamily os_family;
private final HostsMap hostsMap;
private boolean dbInitNeeded;
private final Gson prettyGson = new GsonBuilder().serializeNulls().setPrettyPrinting().create();
@@ -112,11 +134,13 @@ public class ControllerModule extends AbstractModule {
public ControllerModule() throws Exception {
configuration = new Configuration();
hostsMap = new HostsMap(configuration);
+ os_family = new OsFamily(configuration);
}
public ControllerModule(Properties properties) throws Exception {
configuration = new Configuration(properties);
hostsMap = new HostsMap(configuration);
+ os_family = new OsFamily(configuration);
}
@@ -165,9 +189,22 @@ public class ControllerModule extends AbstractModule {
protected void configure() {
installFactories();
+ final SessionIdManager sessionIdManager = new HashSessionIdManager();
+ final SessionManager sessionManager = new HashSessionManager();
+ sessionManager.setSessionPath("/");
+ sessionManager.setSessionIdManager(sessionIdManager);
+ bind(SessionManager.class).toInstance(sessionManager);
+ bind(SessionIdManager.class).toInstance(sessionIdManager);
+
bind(Configuration.class).toInstance(configuration);
+ bind(OsFamily.class).toInstance(os_family);
bind(HostsMap.class).toInstance(hostsMap);
bind(PasswordEncoder.class).toInstance(new StandardPasswordEncoder());
+ bind(DelegatingFilterProxy.class).toInstance(new DelegatingFilterProxy() {
+ {
+ setTargetBeanName("springSecurityFilterChain");
+ }
+ });
bind(Gson.class).annotatedWith(Names.named("prettyGson")).toInstance(prettyGson);
install(buildJpaPersistModule());
@@ -183,7 +220,7 @@ public class ControllerModule extends AbstractModule {
// This time is added to summary timeout time of all tasks in stage
// So it's an "additional time", given to stage to finish execution before
// it is considered as timed out
- bindConstant().annotatedWith(Names.named("actionTimeout")).to(120000L);
+ bindConstant().annotatedWith(Names.named("actionTimeout")).to(600000L);
bindConstant().annotatedWith(Names.named("dbInitNeeded")).to(dbInitNeeded);
bindConstant().annotatedWith(Names.named("statusCheckInterval")).to(5000L);
@@ -199,8 +236,12 @@ public class ControllerModule extends AbstractModule {
bind(ServerActionManager.class).to(ServerActionManagerImpl.class);
bind(ExecutionScheduler.class).to(ExecutionSchedulerImpl.class);
bind(DBAccessor.class).to(DBAccessorImpl.class);
+ bind(ViewInstanceHandlerList.class).to(AmbariHandlerList.class);
requestStaticInjection(ExecutionCommandWrapper.class);
+
+ bindServices();
+ bindEagerSingletons();
}
@@ -276,6 +317,60 @@ public class ControllerModule extends AbstractModule {
install(new FactoryModuleBuilder().build(RequestFactory.class));
bind(HostRoleCommandFactory.class).to(HostRoleCommandFactoryImpl.class);
+ bind(SecurityHelper.class).toInstance(SecurityHelperImpl.getInstance());
}
-}
+ /**
+ * Bind all {@link com.google.common.util.concurrent.Service} singleton
+ * instances and then register them with a singleton {@link ServiceManager}.
+ */
+ private void bindServices() {
+ Set<com.google.common.util.concurrent.Service> services =
+ new HashSet<com.google.common.util.concurrent.Service>();
+
+ AlertNoticeDispatchService alertNoticeDispatchService =
+ new AlertNoticeDispatchService();
+
+ bind(AlertNoticeDispatchService.class).toInstance(
+ alertNoticeDispatchService);
+
+ services.add(alertNoticeDispatchService);
+ ServiceManager manager = new ServiceManager(services);
+ bind(ServiceManager.class).toInstance(manager);
+ }
+
+ /**
+ * Initializes all eager singletons that should be instantiated as soon as
+ * possible and not wait for injection.
+ * <p/>
+ * An example of where this is needed is with a singleton that is headless; in
+ * other words, it doesn't have any injections but still needs to be part of
+ * the Guice framework.
+ * <p/>
+ * This currently scans {@code org.apache.ambari.server} for any
+ * {@link EagerSingleton} instances.
+ */
+ private void bindEagerSingletons() {
+ ClassPathScanningCandidateComponentProvider scanner =
+ new ClassPathScanningCandidateComponentProvider(false);
+
+ // match only singletons that are eager listeners
+ scanner.addIncludeFilter(new AnnotationTypeFilter(EagerSingleton.class));
+
+ Set<BeanDefinition> beanDefinitions = scanner.findCandidateComponents("org.apache.ambari.server");
+
+ if (null == beanDefinitions || beanDefinitions.size() == 0) {
+ LOG.warn("No instances of {} found to register", EagerSingleton.class);
+ return;
+ }
+
+ for (BeanDefinition beanDefinition : beanDefinitions) {
+ String className = beanDefinition.getBeanClassName();
+ Class<?> clazz = ClassUtils.resolveClassName(className,
+ ClassUtils.getDefaultClassLoader());
+
+ bind(clazz).asEagerSingleton();
+ LOG.debug("Binding singleton {} eagerly", clazz);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerRequest.java
new file mode 100644
index 0000000..49121d3
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerRequest.java
@@ -0,0 +1,41 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.controller;
+
+import java.util.Map;
+
+/**
+ * Represents a controller maintenance request.
+ */
+public class ControllerRequest {
+ private final String name;
+ private final Map<String, Object> propertyMap;
+
+ public ControllerRequest(String name, Map<String, Object> propertyMap) {
+ this.name = name;
+ this.propertyMap = propertyMap;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Map<String, Object> getPropertyMap() {
+ return propertyMap;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerResponse.java
new file mode 100644
index 0000000..c75e153
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerResponse.java
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.controller;
+
+/**
+ * Represents a controller maintenance response.
+ */
+public class ControllerResponse {
+ private final String name;
+
+ public ControllerResponse(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/ExecuteActionRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ExecuteActionRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ExecuteActionRequest.java
index 5e42276..c750fca 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ExecuteActionRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ExecuteActionRequest.java
@@ -35,13 +35,15 @@ public class ExecuteActionRequest {
private RequestOperationLevel operationLevel = null;
private String actionName;
private Map<String, String> parameters;
+ private boolean exclusive;
public ExecuteActionRequest(String clusterName, String commandName,
String actionName,
List<RequestResourceFilter> resourceFilters,
RequestOperationLevel operationLevel,
- Map<String, String> parameters) {
- this(clusterName, commandName, parameters);
+ Map<String, String> parameters,
+ boolean exclusive) {
+ this(clusterName, commandName, parameters, exclusive);
this.actionName = actionName;
if (resourceFilters != null) {
this.resourceFilters.addAll(resourceFilters);
@@ -53,7 +55,9 @@ public class ExecuteActionRequest {
* Create an ExecuteActionRequest to execute a command.
* No filters.
*/
- public ExecuteActionRequest(String clusterName, String commandName, Map<String, String> parameters) {
+ public ExecuteActionRequest(String clusterName, String commandName,
+ Map<String, String> parameters,
+ boolean exclusive) {
this.clusterName = clusterName;
this.commandName = commandName;
this.actionName = null;
@@ -62,6 +66,7 @@ public class ExecuteActionRequest {
this.parameters.putAll(parameters);
}
this.resourceFilters = new ArrayList<RequestResourceFilter>();
+ this.exclusive = exclusive;
}
public String getClusterName() {
@@ -88,6 +93,14 @@ public class ExecuteActionRequest {
return parameters;
}
+ public boolean isExclusive() {
+ return exclusive;
+ }
+
+ public void setExclusive(boolean isExclusive) {
+ this.exclusive = isExclusive;
+ }
+
public Boolean isCommand() {
return actionName == null || actionName.isEmpty();
}
@@ -100,6 +113,7 @@ public class ExecuteActionRequest {
append(", command :" + commandName).
append(", inputs :" + parameters.toString()).
append(", resourceFilters: " + resourceFilters).
+ append(", exclusive: " + exclusive).
append(", clusterName :" + clusterName).toString();
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/FailsafeHandlerList.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/FailsafeHandlerList.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/FailsafeHandlerList.java
new file mode 100644
index 0000000..fa1e6b1
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/FailsafeHandlerList.java
@@ -0,0 +1,139 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.controller;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.jetty.server.Handler;
+import org.eclipse.jetty.server.Request;
+import org.eclipse.jetty.server.handler.HandlerCollection;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This extension of {@link HandlerCollection} will call each contained handler
+ * in turn until the response is committed, a positive response status is set or
+ * an exception from important handler is thrown. Handlers added via
+ * {@link #addFailsafeHandler(Handler)} do not stop the polling when they raise
+ * an exception.
+ *
+ */
+public class FailsafeHandlerList extends HandlerCollection {
+
+ /**
+ * Logger.
+ */
+ private static Logger LOG = LoggerFactory.getLogger(FailsafeHandlerList.class);
+
+ /**
+ * Fail-safe handlers do not stop the processing of the request if they raise an exception.
+ */
+ private final List<Handler> failsafeHandlers = new ArrayList<Handler>();
+
+
+ // ----- Constructors ------------------------------------------------------
+
+ /**
+ * Construct a FailsafeHandlerList.
+ */
+ public FailsafeHandlerList() {
+ }
+
+ /**
+ * Construct a FailsafeHandlerList.
+ *
+ * @param mutableWhenRunning allow for changes while running
+ */
+ public FailsafeHandlerList(boolean mutableWhenRunning) {
+ super(mutableWhenRunning);
+ }
+
+
+ // ----- FailsafeHandlerList -----------------------------------------------
+
+ /**
+ * Adds handler to collection and marks it as fail-safe.
+ *
+ * @param handler fail-safe handler
+ */
+ public void addFailsafeHandler(Handler handler) {
+ addHandler(handler);
+ failsafeHandlers.add(handler);
+ }
+
+
+ // ----- HandlerCollection -------------------------------------------------
+
+ @Override
+ public void removeHandler(Handler handler) {
+ super.removeHandler(handler);
+ failsafeHandlers.remove(handler);
+ }
+
+ /**
+ * @see Handler#handle(String, Request, HttpServletRequest,
+ * HttpServletResponse)
+ */
+ @Override
+ public void handle(String target, Request baseRequest,
+ HttpServletRequest request, HttpServletResponse response)
+ throws IOException, ServletException {
+
+ final Handler[] handlers = getHandlers();
+
+ if (handlers != null && isStarted()) {
+
+ List<Handler> nonFailsafeHandlers = new ArrayList<Handler>();
+
+ for (int i = 0; i < handlers.length; i++) {
+ final Handler handler = handlers[i];
+ // Do all of the fail-safe handlers first...
+ if (failsafeHandlers.contains(handler)) {
+ try {
+ final FailsafeServletResponse responseWrapper = new FailsafeServletResponse(response);
+ handler.handle(target, baseRequest, request, responseWrapper);
+ if (responseWrapper.isRequestFailed()) {
+ response.reset();
+ baseRequest.setHandled(false);
+ }
+ } catch (Exception ex) {
+ LOG.warn("Fail-safe handler failed to process request, continuing handler polling", ex);
+ continue;
+ }
+ } else {
+ nonFailsafeHandlers.add(handler);
+ }
+ if (baseRequest.isHandled()) {
+ return;
+ }
+ }
+
+ for (Handler handler : nonFailsafeHandlers) {
+ handler.handle(target, baseRequest, request, response);
+ if (baseRequest.isHandled()) {
+ return;
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/FailsafeServletResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/FailsafeServletResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/FailsafeServletResponse.java
new file mode 100644
index 0000000..094c4c5
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/FailsafeServletResponse.java
@@ -0,0 +1,77 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.controller;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
+
+/**
+ * Wraps standard wrapper for {@link HttpServletResponse} to cancel sending
+ * errors on failed requests.
+ */
+public class FailsafeServletResponse extends HttpServletResponseWrapper {
+ /**
+ * Indicates that request failed.
+ */
+ private boolean error;
+
+ /**
+ * List of errors which should not be consumed by fail-safe handler.
+ */
+ private List<Integer> allowedErrors = Arrays.asList(HttpServletResponse.SC_FORBIDDEN);
+
+ /**
+ * Constructor.
+ *
+ * @param response response to be wrapped
+ */
+ public FailsafeServletResponse(HttpServletResponse response) {
+ super(response);
+ }
+
+ @Override
+ public void sendError(int sc) throws IOException {
+ if (allowedErrors.contains(sc)) {
+ super.sendError(sc);
+ } else {
+ error = true;
+ }
+ }
+
+ @Override
+ public void sendError(int sc, String msg) throws IOException {
+ if (allowedErrors.contains(sc)) {
+ super.sendError(sc, msg);
+ } else {
+ error = true;
+ }
+ }
+
+ /**
+ * Indicates that request failed to execute.
+ *
+ * @return true if request failed
+ */
+ public boolean isRequestFailed() {
+ return error;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/HostRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/HostRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/HostRequest.java
index f3668c1..b577bb0 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/HostRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/HostRequest.java
@@ -18,6 +18,7 @@
package org.apache.ambari.server.controller;
+import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -28,7 +29,7 @@ public class HostRequest {
private String clusterName; // CREATE/UPDATE
private Map<String, String> hostAttributes; // CREATE/UPDATE
private String rackInfo;
- private ConfigurationRequest desiredConfig; // UPDATE
+ private List<ConfigurationRequest> desiredConfigs; // UPDATE
private String maintenanceState; // UPDATE
public HostRequest(String hostname, String clusterName, Map<String, String> hostAttributes) {
@@ -77,12 +78,12 @@ public class HostRequest {
publicHostname = name;
}
- public void setDesiredConfig(ConfigurationRequest request) {
- desiredConfig = request;
+ public void setDesiredConfigs(List<ConfigurationRequest> request) {
+ desiredConfigs = request;
}
- public ConfigurationRequest getDesiredConfig() {
- return desiredConfig;
+ public List<ConfigurationRequest> getDesiredConfigs() {
+ return desiredConfigs;
}
public void setMaintenanceState(String state) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/LdapSyncRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/LdapSyncRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/LdapSyncRequest.java
new file mode 100644
index 0000000..02cf3f0
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/LdapSyncRequest.java
@@ -0,0 +1,94 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.server.controller;
+
+import org.apache.ambari.server.orm.entities.LdapSyncSpecEntity;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Request for LDAP synchronization.
+ */
+public class LdapSyncRequest {
+
+ /**
+ * The principal names for the request.
+ */
+ private final Set<String> principalNames;
+
+ /**
+ * The type of request.
+ */
+ private final LdapSyncSpecEntity.SyncType type;
+
+
+ // ----- Constructors ------------------------------------------------------
+
+ /**
+ * Construct an LdapSyncRequest.
+ *
+ * @param type the request type
+ * @param principalNames the principal names
+ */
+ public LdapSyncRequest(LdapSyncSpecEntity.SyncType type, Set<String> principalNames) {
+ this.type = type;
+ this.principalNames = principalNames == null ? new HashSet<String>() : principalNames;
+ }
+
+ /**
+ * Construct an LdapSyncRequest.
+ *
+ * @param type the request type
+ */
+ public LdapSyncRequest(LdapSyncSpecEntity.SyncType type) {
+ this.principalNames = new HashSet<String>();
+ this.type = type;
+ }
+
+
+ // ----- LdapSyncRequest ---------------------------------------------------
+
+ /**
+ * Add principal names to the request.
+ *
+ * @param principalNames the principal names to be added
+ */
+ public void addPrincipalNames(Set<String> principalNames) {
+ this.principalNames.addAll(principalNames);
+ }
+
+ /**
+ * Get the principal names.
+ *
+ * @return the principal names
+ */
+ public Set<String> getPrincipalNames() {
+ return principalNames;
+ }
+
+ /**
+ * Get the request type.
+ *
+ * @return the request type
+ */
+ public LdapSyncSpecEntity.SyncType getType() {
+ return type;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/MaintenanceStateHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/MaintenanceStateHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/MaintenanceStateHelper.java
index 77c7167..459f01f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/MaintenanceStateHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/MaintenanceStateHelper.java
@@ -50,7 +50,8 @@ public class MaintenanceStateHelper {
private static final String NAGIOS_COMPONENT = "NAGIOS_SERVER";
private static final String NAGIOS_ACTION_NAME = "nagios_update_ignore";
private static final Logger LOG = LoggerFactory.getLogger(MaintenanceStateHelper.class);
-
+ public static final String UPDATE_NAGIOS_REQUEST_NAME = "Adjusting ignored alerts for Services/Hosts Maintenance Mode";
+
@Inject
private Clusters clusters;
@@ -250,40 +251,40 @@ public class MaintenanceStateHelper {
}
/**
- * Creates the requests to send to the clusters. These requests
- * update ignored allerts Nagios configuration.
+ * Creates the Nagios update request to send to the cluster. This request
+ * updates ignored allerts Nagios configuration.
* @param amc the controller
* @param requestProperties the request properties
- * @param clusterNames the names of all the clusters to update
+ * @param clusterName the names of clusters to update
* @return the response
* @throws AmbariException
*/
public RequestStatusResponse createRequests(AmbariManagementController amc,
- Map<String, String> requestProperties, Set<String> clusterNames)
+ Map<String, String> requestProperties, String clusterName)
throws AmbariException {
+ // Substitute another request name
Map<String, String> params = new HashMap<String, String>();
-
- // return the first one, just like amc.createStages()
- RequestStatusResponse response = null;
+ Map<String, String> requestPropertiesClone = new HashMap<String, String>(requestProperties.size());
+ requestPropertiesClone.putAll(requestProperties);
+ requestPropertiesClone.put("context", UPDATE_NAGIOS_REQUEST_NAME);
RequestResourceFilter resourceFilter =
new RequestResourceFilter(NAGIOS_SERVICE, NAGIOS_COMPONENT, null);
- for (String clusterName : clusterNames) {
- ExecuteActionRequest actionRequest = new ExecuteActionRequest(
- clusterName, null, NAGIOS_ACTION_NAME,
- Collections.singletonList(resourceFilter),
- null, params);
-
- if (null == response) {
- // createAction() may throw an exception if Nagios is in MS or
- // if Nagios is absent in cluster. This exception is usually ignored at
- // upper levels
- response = amc.createAction(actionRequest, requestProperties);
- }
- }
- return response;
+ RequestOperationLevel level =
+ new RequestOperationLevel(Resource.Type.HostComponent,
+ clusterName, NAGIOS_SERVICE, NAGIOS_COMPONENT, null);
+
+ ExecuteActionRequest actionRequest = new ExecuteActionRequest(
+ clusterName, null, NAGIOS_ACTION_NAME,
+ Collections.singletonList(resourceFilter),
+ level, params, true);
+
+ // createAction() may throw an exception if Nagios is in MS or
+ // if Nagios is absent in cluster. This exception is usually ignored at
+ // upper levels
+ return amc.createAction(actionRequest, requestPropertiesClone);
}
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/RequestRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/RequestRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/RequestRequest.java
new file mode 100644
index 0000000..db9268b
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/RequestRequest.java
@@ -0,0 +1,82 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.controller;
+
+import org.apache.ambari.server.actionmanager.HostRoleStatus;
+
+/**
+ * Encapsulates all data about update request that came to RequestResourceProvider
+ */
+public class RequestRequest {
+
+ public RequestRequest(String clusterName, long requestId) {
+ this.clusterName = clusterName;
+ this.requestId = requestId;
+ }
+
+ private String clusterName;
+
+ private long requestId;
+
+ private HostRoleStatus status;
+
+ private String abortReason;
+
+
+ public HostRoleStatus getStatus() {
+ return status;
+ }
+
+ public String getClusterName() {
+ return clusterName;
+ }
+
+ public void setClusterName(String clusterName) {
+ this.clusterName = clusterName;
+ }
+
+ public long getRequestId() {
+ return requestId;
+ }
+
+ public void setRequestId(int requestId) {
+ this.requestId = requestId;
+ }
+
+ public void setStatus(HostRoleStatus status) {
+ this.status = status;
+ }
+
+ public String getAbortReason() {
+ return abortReason;
+ }
+
+ public void setAbortReason(String abortReason) {
+ this.abortReason = abortReason;
+ }
+
+ @Override
+ public String toString() {
+ return "RequestRequest{" +
+ "clusterName='" + clusterName + '\'' +
+ ", requestId=" + requestId +
+ ", status=" + status +
+ ", abortReason='" + abortReason + '\'' +
+ '}';
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/RequestStatusResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/RequestStatusResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/RequestStatusResponse.java
index d6eabf4..26d866d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/RequestStatusResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/RequestStatusResponse.java
@@ -31,6 +31,11 @@ public class RequestStatusResponse {
private String logs;
/**
+ * Request message
+ */
+ private String message;
+
+ /**
* Request context
*/
private String requestContext;
@@ -78,4 +83,11 @@ public class RequestStatusResponse {
this.requestContext = requestContext;
}
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionRequest.java
new file mode 100644
index 0000000..b32ccdf
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionRequest.java
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.server.controller;
+
+public class ServiceConfigVersionRequest {
+ private String clusterName;
+ private String serviceName;
+ private Long version;
+ private Long createTime;
+ private Long applyTime;
+ private String userName;
+ private String note;
+ private Boolean isCurrent;
+
+ public ServiceConfigVersionRequest() {
+ }
+
+ public ServiceConfigVersionRequest(String clusterName, String serviceName, Long version, Long createTime, Long applyTime, String userName) {
+ this.clusterName = clusterName;
+ this.serviceName = serviceName;
+ this.version = version;
+ this.createTime = createTime;
+ this.applyTime = applyTime;
+ this.userName = userName;
+ }
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public Long getVersion() {
+ return version;
+ }
+
+ public void setVersion(Long version) {
+ this.version = version;
+ }
+
+ public Long getCreateTime() {
+ return createTime;
+ }
+
+ public void setCreateTime(Long createTime) {
+ this.createTime = createTime;
+ }
+
+ public Long getApplyTime() {
+ return applyTime;
+ }
+
+ public void setApplyTime(Long applyTime) {
+ this.applyTime = applyTime;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ public String getClusterName() {
+ return clusterName;
+ }
+
+ public void setClusterName(String clusterName) {
+ this.clusterName = clusterName;
+ }
+
+ public String getNote() {
+ return note;
+ }
+
+ public void setNote(String note) {
+ this.note = note;
+ }
+
+ public Boolean getIsCurrent() {
+ return isCurrent;
+ }
+
+ public void setIsCurrent(Boolean isCurrent) {
+ this.isCurrent = isCurrent;
+ }
+
+ @Override
+ public String toString() {
+ return "ServiceConfigVersionRequest{" +
+ "clusterName='" + clusterName + '\'' +
+ ", serviceName='" + serviceName + '\'' +
+ ", version=" + version +
+ ", createTime=" + createTime +
+ ", applyTime=" + applyTime +
+ ", userName='" + userName + '\'' +
+ ", note='" + note + '\'' +
+ ", isCurrent=" + isCurrent +
+ '}';
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionResponse.java
new file mode 100644
index 0000000..b4cc7e8
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceConfigVersionResponse.java
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.server.controller;
+
+
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+
+import java.util.List;
+
+public class ServiceConfigVersionResponse {
+ private String clusterName;
+ private String serviceName;
+ private Long version;
+ private Long createTime;
+ private Long groupId;
+ private String groupName;
+ private String userName;
+ private String note;
+ private Boolean isCurrent = false;
+ private List<ConfigurationResponse> configurations;
+ private List<String> hosts;
+
+ @JsonProperty("service_name")
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ @JsonProperty("service_config_version")
+ public Long getVersion() {
+ return version;
+ }
+
+ public void setVersion(Long version) {
+ this.version = version;
+ }
+
+ @JsonProperty("createtime")
+ @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+ public Long getCreateTime() {
+ return createTime;
+ }
+
+ public void setCreateTime(Long createTime) {
+ this.createTime = createTime;
+ }
+
+ @JsonProperty("user")
+ @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ @JsonProperty("cluster_name")
+ @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+ public String getClusterName() {
+ return clusterName;
+ }
+
+ public void setClusterName(String clusterName) {
+ this.clusterName = clusterName;
+ }
+
+ @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+ public List<ConfigurationResponse> getConfigurations() {
+ return configurations;
+ }
+
+ public void setConfigurations(List<ConfigurationResponse> configurations) {
+ this.configurations = configurations;
+ }
+
+ @JsonProperty("service_config_version_note")
+ @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+ public String getNote() {
+ return note;
+ }
+
+ public void setNote(String note) {
+ this.note = note;
+ }
+
+ public List<String> getHosts() {
+ return hosts;
+ }
+
+ @JsonProperty("hosts")
+ public void setHosts(List<String> hosts) {
+ this.hosts = hosts;
+ }
+
+ @JsonProperty("group_name")
+ public String getGroupName() {
+ return groupName;
+ }
+
+ public void setGroupName(String groupName) {
+ this.groupName = groupName;
+ }
+
+ @JsonProperty("group_id")
+ public Long getGroupId() {
+ return groupId;
+ }
+
+ public void setGroupId(Long groupId) {
+ this.groupId = groupId;
+ }
+
+ @JsonProperty("is_current")
+ public Boolean getIsCurrent() {
+ return isCurrent;
+ }
+
+ public void setIsCurrent(Boolean isCurrent) {
+ this.isCurrent = isCurrent;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/ShortTaskStatus.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ShortTaskStatus.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ShortTaskStatus.java
index e84ac3d..3155746 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ShortTaskStatus.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ShortTaskStatus.java
@@ -28,12 +28,14 @@ public class ShortTaskStatus {
protected String command;
protected String status;
protected String customCommandName;
+ protected String outputLog;
+ protected String errorLog;
public ShortTaskStatus() {
}
public ShortTaskStatus(int taskId, long stageId, String hostName, String role, String command, String status,
- String customCommandName) {
+ String customCommandName, String outputLog, String errorLog) {
this.taskId = taskId;
this.stageId = stageId;
this.hostName = hostName;
@@ -41,6 +43,8 @@ public class ShortTaskStatus {
this.command = command;
this.status = status;
this.customCommandName = customCommandName;
+ this.outputLog = outputLog;
+ this.errorLog = errorLog;
}
public ShortTaskStatus(HostRoleCommand hostRoleCommand) {
@@ -51,6 +55,8 @@ public class ShortTaskStatus {
this.role = hostRoleCommand.getRole().toString();
this.status = hostRoleCommand.getStatus().toString();
this.customCommandName = hostRoleCommand.getCustomCommandName();
+ this.outputLog = hostRoleCommand.getOutputLog();
+ this.errorLog = hostRoleCommand.getErrorLog();
}
public String getCustomCommandName() {
@@ -101,6 +107,22 @@ public class ShortTaskStatus {
this.command = command;
}
+ public String getOutputLog() {
+ return outputLog;
+ }
+
+ public void setOutputLog(String outputLog) {
+ this.outputLog = outputLog;
+ }
+
+ public String getErrorLog() {
+ return errorLog;
+ }
+
+ public void setErrorLog(String errorLog) {
+ this.errorLog = errorLog;
+ }
+
public String getStatus() {
return status;
}
@@ -117,7 +139,10 @@ public class ShortTaskStatus {
+ ", hostname=" + hostName
+ ", role=" + role
+ ", command=" + command
- + ", status=" + status);
+ + ", status=" + status
+ + ", outputLog=" + outputLog
+ + ", errorLog=" + errorLog
+ );
return sb.toString();
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/StackConfigurationResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackConfigurationResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackConfigurationResponse.java
index 44454ec..9a7831e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackConfigurationResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackConfigurationResponse.java
@@ -19,6 +19,11 @@
package org.apache.ambari.server.controller;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.ambari.server.state.PropertyInfo.PropertyType;
+
public class StackConfigurationResponse {
/**
@@ -27,14 +32,15 @@ public class StackConfigurationResponse {
* @param propertyValue Property Value
* @param propertyDescription Property Description
* @param type Configuration type
- * @param isFinal Is property final
+ * @param propertyAttributes Attributes map
*/
- public StackConfigurationResponse(String propertyName, String propertyValue, String propertyDescription, String type, Boolean isFinal) {
+ public StackConfigurationResponse(String propertyName, String propertyValue, String propertyDescription,
+ String type, Map<String, String> propertyAttributes) {
setPropertyName(propertyName);
setPropertyValue(propertyValue);
setPropertyDescription(propertyDescription);
setType(type);
- setFinal(isFinal);
+ setPropertyAttributes(propertyAttributes);
}
/**
@@ -45,18 +51,18 @@ public class StackConfigurationResponse {
* @param type Configuration type
* @param isRequired Is required to be set
* @param propertyType Property Type
- * @param isFinal Is property final
+ * @param propertyAttributes Attributes map
*/
public StackConfigurationResponse(String propertyName, String propertyValue,
String propertyDescription, String type,
- Boolean isRequired, String propertyType, Boolean isFinal) {
+ Boolean isRequired, Set<PropertyType> propertyTypes, Map<String, String> propertyAttributes) {
setPropertyName(propertyName);
setPropertyValue(propertyValue);
setPropertyDescription(propertyDescription);
setType(type);
setRequired(isRequired);
- setPropertyType(propertyType);
- setFinal(isFinal);
+ setPropertyType(propertyTypes);
+ setPropertyAttributes(propertyAttributes);
}
private String stackName;
@@ -66,9 +72,9 @@ public class StackConfigurationResponse {
private String propertyValue;
private String propertyDescription;
private String type;
- private Boolean isFinal;
+ private Map<String, String> propertyAttributes;
private Boolean isRequired;
- private String propertyType;
+ private Set<PropertyType> propertyTypes;
public String getStackName() {
return stackName;
@@ -130,12 +136,22 @@ public class StackConfigurationResponse {
this.type = type;
}
- public Boolean isFinal() {
- return isFinal;
+ /**
+ * Provides attributes of this configuration.
+ *
+ * @return Map of attribute name to attribute value
+ */
+ public Map<String, String> getPropertyAttributes() {
+ return propertyAttributes;
}
- public void setFinal(Boolean isFinal) {
- this.isFinal = isFinal;
+ /**
+ * Sets attributes for this configuration.
+ *
+ * @param propertyAttributes Map of attribute name to attribute value
+ */
+ public void setPropertyAttributes(Map<String, String> propertyAttributes) {
+ this.propertyAttributes = propertyAttributes;
}
/**
@@ -158,11 +174,11 @@ public class StackConfigurationResponse {
* Get type of property as set in the stack definition.
* @return Property type.
*/
- public String getPropertyType() {
- return propertyType;
+ public Set<PropertyType> getPropertyType() {
+ return propertyTypes;
}
- public void setPropertyType(String propertyType) {
- this.propertyType = propertyType;
+ public void setPropertyType(Set<PropertyType> propertyTypes) {
+ this.propertyTypes = propertyTypes;
}
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/StackLevelConfigurationRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackLevelConfigurationRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackLevelConfigurationRequest.java
new file mode 100644
index 0000000..53d3ecf
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackLevelConfigurationRequest.java
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.ambari.server.controller;
+
+public class StackLevelConfigurationRequest extends StackVersionRequest {
+
+ private String propertyName;
+
+ public StackLevelConfigurationRequest(String stackName, String stackVersion,
+ String propertyName) {
+ super(stackName, stackVersion);
+
+ setPropertyName(propertyName);
+
+ }
+
+ public String getPropertyName() {
+ return propertyName;
+ }
+
+ public void setPropertyName(String propertyName) {
+ this.propertyName = propertyName;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/StackLevelConfigurationResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackLevelConfigurationResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackLevelConfigurationResponse.java
new file mode 100644
index 0000000..b225a5c
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackLevelConfigurationResponse.java
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ambari.server.controller;
+
+
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.ambari.server.state.PropertyInfo.PropertyType;
+
+public class StackLevelConfigurationResponse extends StackConfigurationResponse {
+ public StackLevelConfigurationResponse(String propertyName,
+ String propertyValue, String propertyDescription, String type,
+ Boolean isRequired, Set<PropertyType> propertyTypes,
+ Map<String, String> propertyAttributes) {
+ super(propertyName, propertyValue, propertyDescription, type, isRequired,
+ propertyTypes, propertyAttributes);
+ }
+
+ public StackLevelConfigurationResponse(String propertyName, String propertyValue, String propertyDescription,
+ String type, Map<String, String> propertyAttributes) {
+ super(propertyName, propertyValue, propertyDescription, type, propertyAttributes);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceComponentResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceComponentResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceComponentResponse.java
index fe2c0d6..47d153b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceComponentResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceComponentResponse.java
@@ -19,6 +19,12 @@
package org.apache.ambari.server.controller;
import org.apache.ambari.server.state.AutoDeployInfo;
+import org.apache.ambari.server.state.ComponentInfo;
+import org.apache.ambari.server.state.CustomCommandDefinition;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
/**
* Stack service component response.
@@ -45,6 +51,11 @@ public class StackServiceComponentResponse {
private String componentName;
/**
+ * component display name
+ */
+ private String componentDisplayName;
+
+ /**
* component category
*/
private String componentCategory;
@@ -69,14 +80,37 @@ public class StackServiceComponentResponse {
*/
private AutoDeployInfo autoDeploy;
+ /**
+ * The names of the custom commands defined for the component.
+ */
+ private List<String> customCommands;
+
- public StackServiceComponentResponse(String componentName, String componentCategory,
- boolean isClient, boolean isMaster, String cardinality) {
- setComponentName(componentName);
- setComponentCategory(componentCategory);
- setClient(isClient);
- setMaster(isMaster);
- setCardinality(cardinality);
+ /**
+ * Constructor.
+ *
+ * @param component
+ * the component to generate the response from (not {@code null}).
+ */
+ public StackServiceComponentResponse(ComponentInfo component) {
+ componentName = component.getName();
+ componentDisplayName = component.getDisplayName();
+ componentCategory = component.getCategory();
+ isClient = component.isClient();
+ isMaster = component.isMaster();
+ cardinality = component.getCardinality();
+ autoDeploy = component.getAutoDeploy();
+
+ // the custom command names defined for this component
+ List<CustomCommandDefinition> definitions = component.getCustomCommands();
+ if (null == definitions || definitions.size() == 0) {
+ customCommands = Collections.emptyList();
+ } else {
+ customCommands = new ArrayList<String>(definitions.size());
+ for (CustomCommandDefinition command : definitions) {
+ customCommands.add(command.getName());
+ }
+ }
}
/**
@@ -152,6 +186,25 @@ public class StackServiceComponentResponse {
}
/**
+ * Get component display name.
+ *
+ * @return component display name
+ */
+
+ public String getComponentDisplayName() {
+ return componentDisplayName;
+ }
+
+ /**
+ * Set component display name.
+ *
+ * @param componentDisplayName component display name
+ */
+ public void setComponentDisplayName(String componentDisplayName) {
+ this.componentDisplayName = componentDisplayName;
+ }
+
+ /**
* Get component category.
*
* @return component category
@@ -240,4 +293,13 @@ public class StackServiceComponentResponse {
public void setAutoDeploy(AutoDeployInfo autoDeploy) {
this.autoDeploy = autoDeploy;
}
+
+ /**
+ * Gets the names of all of the custom commands for this component.
+ *
+ * @return the commands or an empty list (never {@code null}).
+ */
+ public List<String> getCustomCommands() {
+ return customCommands;
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceResponse.java
index df91239..39c5cf6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceResponse.java
@@ -18,6 +18,12 @@
package org.apache.ambari.server.controller;
+import org.apache.ambari.server.state.CustomCommandDefinition;
+import org.apache.ambari.server.state.ServiceInfo;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
import java.util.Map;
public class StackServiceResponse {
@@ -25,22 +31,42 @@ public class StackServiceResponse {
private String stackName;
private String stackVersion;
private String serviceName;
-
+ private String serviceDisplayName;
private String userName;
-
private String comments;
-
private String serviceVersion;
-
- private Map<String, Map<String, Map<String, String>>> configTypes;
+ private boolean serviceCheckSupported;
+ private List<String> customCommands;
- public StackServiceResponse(String serviceName, String userName, String comments, String serviceVersion,
- Map<String, Map<String, Map<String, String>>> types) {
- setServiceName(serviceName);
- setUserName(userName);
- setComments(comments);
- setServiceVersion(serviceVersion);
- configTypes = types;
+ private Map<String, Map<String, Map<String, String>>> configTypes;
+ private List<String> requiredServices;
+
+ /**
+ * Constructor.
+ *
+ * @param service
+ * the service to generate the response from (not {@code null}).
+ */
+ public StackServiceResponse(ServiceInfo service) {
+ serviceName = service.getName();
+ serviceDisplayName = service.getDisplayName();
+ userName = null;
+ comments = service.getComment();
+ serviceVersion = service.getVersion();
+ configTypes = service.getConfigTypes();
+ requiredServices = service.getRequiredServices();
+ serviceCheckSupported = null != service.getCommandScript();
+
+ // the custom command names defined at the service (not component) level
+ List<CustomCommandDefinition> definitions = service.getCustomCommands();
+ if (null == definitions || definitions.size() == 0) {
+ customCommands = Collections.emptyList();
+ } else {
+ customCommands = new ArrayList<String>(definitions.size());
+ for (CustomCommandDefinition command : definitions) {
+ customCommands.add(command.getName());
+ }
+ }
}
public String getStackName() {
@@ -67,6 +93,14 @@ public class StackServiceResponse {
this.serviceName = serviceName;
}
+ public String getServiceDisplayName() {
+ return serviceDisplayName;
+ }
+
+ public void setServiceDisplayName(String serviceDisplayName) {
+ this.serviceDisplayName = serviceDisplayName;
+ }
+
public String getUserName() {
return userName;
}
@@ -90,9 +124,39 @@ public class StackServiceResponse {
public void setServiceVersion(String serviceVersion) {
this.serviceVersion = serviceVersion;
}
-
+
public Map<String, Map<String, Map<String, String>>> getConfigTypes() {
return configTypes;
}
+ public List<String> getRequiredServices() {
+ return requiredServices;
+ }
+
+ public void setRequiredServices(List<String> requiredServices) {
+ this.requiredServices = requiredServices;
+ }
+
+ /**
+ * Gets whether the service represented by this response supports running
+ * "Service Checks". A service check is possible where there is a custom
+ * command defined in the {@code metainfo.xml} of the service definition. This
+ * not the same as a custom command defined for a component.
+ *
+ * @return {@code true} if this service supports running "Service Checks",
+ * {@code false} otherwise.
+ *
+ */
+ public boolean isServiceCheckSupported() {
+ return serviceCheckSupported;
+ }
+
+ /**
+ * Gets the names of all of the custom commands for this service.
+ *
+ * @return the commands or an empty list (never {@code null}).
+ */
+ public List<String> getCustomCommands() {
+ return customCommands;
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/StackVersionResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackVersionResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackVersionResponse.java
index 84105fc..48d3fe1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackVersionResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackVersionResponse.java
@@ -18,6 +18,8 @@
package org.apache.ambari.server.controller;
+import java.util.Map;
+
public class StackVersionResponse {
@@ -26,13 +28,16 @@ public class StackVersionResponse {
private String minUpgradeVersion;
private boolean active;
private String parentVersion;
+ private Map<String, Map<String, Map<String, String>>> configTypes;
public StackVersionResponse(String stackVersion, String minUpgradeVersion,
- boolean active, String parentVersion) {
+ boolean active, String parentVersion,
+ Map<String, Map<String, Map<String, String>>> configTypes) {
setStackVersion(stackVersion);
setMinUpgradeVersion(minUpgradeVersion);
setActive(active);
setParentVersion(parentVersion);
+ setConfigTypes(configTypes);
}
public String getStackName() {
@@ -74,4 +79,11 @@ public class StackVersionResponse {
public void setParentVersion(String parentVersion) {
this.parentVersion = parentVersion;
}
+ public Map<String, Map<String, Map<String, String>>> getConfigTypes() {
+ return configTypes;
+ }
+ public void setConfigTypes(
+ Map<String, Map<String, Map<String, String>>> configTypes) {
+ this.configTypes = configTypes;
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/TaskStatusResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/TaskStatusResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/TaskStatusResponse.java
index c413f2d..892b1c3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/TaskStatusResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/TaskStatusResponse.java
@@ -37,8 +37,8 @@ public class TaskStatusResponse extends ShortTaskStatus {
public TaskStatusResponse(long requestId,
int taskId, long stageId, String hostName, String role, String command, String status,
int exitCode, String stderr, String stdout, long startTime, short attemptCount,
- String commandDetail, String customCommandName) {
- super(taskId, stageId, hostName, role, command, status, customCommandName);
+ String commandDetail, String customCommandName, String outputLog, String errorLog) {
+ super(taskId, stageId, hostName, role, command, status, customCommandName, outputLog, errorLog);
this.requestId = requestId;
this.exitCode = exitCode;
this.stderr = stderr;
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/UserRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/UserRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/UserRequest.java
index bd9a9f9..282131a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/UserRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/UserRequest.java
@@ -17,9 +17,6 @@
*/
package org.apache.ambari.server.controller;
-import java.util.HashSet;
-import java.util.Set;
-
/**
* Represents a user maintenance request.
*/
@@ -28,7 +25,7 @@ public class UserRequest {
private String password;
private String oldPassword;
private Boolean active;
- private Set<String> roles = new HashSet<String>();
+ private Boolean admin;
public UserRequest(String name) {
this.userName = name;
@@ -38,14 +35,6 @@ public class UserRequest {
return userName;
}
- public Set<String> getRoles() {
- return roles;
- }
-
- public void setRoles(Set<String> userRoles) {
- roles = userRoles;
- }
-
public String getPassword() {
return password;
}
@@ -70,23 +59,18 @@ public class UserRequest {
this.active = active;
}
+ public Boolean isAdmin() {
+ return admin;
+ }
+
+ public void setAdmin(Boolean admin) {
+ this.admin = admin;
+ }
+
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
- sb.append("User"
- + ", username=" + userName
- + ", roles=[ ");
- if (roles != null && !roles.isEmpty()) {
- boolean first = true;
- for (String role : roles) {
- if (!first) {
- sb.append(",");
- }
- first = false;
- sb.append(role);
- }
- }
- sb.append(" ]");
+ sb.append("User, username=" + userName);
return sb.toString();
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/UserResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/UserResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/UserResponse.java
index a5c13d2..868635c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/UserResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/UserResponse.java
@@ -25,27 +25,29 @@ import java.util.Set;
*/
public class UserResponse {
- private Set<String> roles = Collections.emptySet();
private final String userName;
private final boolean isLdapUser;
private final boolean isActive;
+ private final boolean isAdmin;
+ private Set<String> groups = Collections.emptySet();
- public UserResponse(String name, boolean isLdapUser, boolean isActive) {
+ public UserResponse(String name, boolean isLdapUser, boolean isActive, boolean isAdmin) {
this.userName = name;
this.isLdapUser = isLdapUser;
this.isActive = isActive;
+ this.isAdmin = isAdmin;
}
public String getUsername() {
return userName;
}
- public Set<String> getRoles() {
- return roles;
+ public Set<String> getGroups() {
+ return groups;
}
- public void setRoles(Set<String> userRoles) {
- roles = userRoles;
+ public void setGroups(Set<String> groups) {
+ this.groups = groups;
}
@Override
@@ -79,4 +81,8 @@ public class UserResponse {
public boolean isActive() {
return isActive;
}
+
+ public boolean isAdmin() {
+ return isAdmin;
+ }
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProvider.java
index 4d623c1..39a6b61 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ganglia/GangliaPropertyProvider.java
@@ -552,7 +552,7 @@ public abstract class GangliaPropertyProvider extends AbstractPropertyProvider {
}
} catch (IOException e) {
if (LOG.isErrorEnabled()) {
- LOG.error("Caught exception getting Ganglia metrics : spec=" + spec, e);
+ LOG.error("Caught exception getting Ganglia metrics : spec=" + spec);
}
} finally {
if (reader != null) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/9213dcca/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java
index f68f21c..cb6c271 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java
@@ -18,18 +18,15 @@
package org.apache.ambari.server.controller.internal;
+import java.util.Map;
+import java.util.Set;
+
import org.apache.ambari.server.controller.AmbariManagementController;
import org.apache.ambari.server.controller.ResourceProviderFactory;
-import org.apache.ambari.server.controller.predicate.ArrayPredicate;
-import org.apache.ambari.server.controller.predicate.EqualsPredicate;
-import org.apache.ambari.server.controller.spi.Predicate;
import org.apache.ambari.server.controller.spi.Resource;
import org.apache.ambari.server.controller.spi.ResourceProvider;
import org.apache.ambari.server.controller.utilities.ClusterControllerHelper;
-import java.util.Map;
-import java.util.Set;
-
/**
* Abstract resource provider implementation that maps to an Ambari management controller.
*/
@@ -104,6 +101,8 @@ public abstract class AbstractControllerResourceProvider extends AbstractResourc
return resourceProviderFactory.getHostComponentResourceProvider(propertyIds, keyPropertyIds, managementController);
case Configuration:
return new ConfigurationResourceProvider(propertyIds, keyPropertyIds, managementController);
+ case ServiceConfigVersion:
+ return new ServiceConfigVersionResourceProvider(propertyIds, keyPropertyIds, managementController);
case Action:
return new ActionResourceProvider(propertyIds, keyPropertyIds, managementController);
case Request:
@@ -128,6 +127,8 @@ public abstract class AbstractControllerResourceProvider extends AbstractResourc
return new StackConfigurationResourceProvider(propertyIds, keyPropertyIds, managementController);
case OperatingSystem:
return new OperatingSystemResourceProvider(propertyIds, keyPropertyIds, managementController);
+ case StackLevelConfiguration:
+ return new StackLevelConfigurationResourceProvider(propertyIds, keyPropertyIds, managementController);
case Repository:
return new RepositoryResourceProvider(propertyIds, keyPropertyIds, managementController);
case RootService:
@@ -144,6 +145,14 @@ public abstract class AbstractControllerResourceProvider extends AbstractResourc
return new HostComponentProcessResourceProvider(propertyIds, keyPropertyIds, managementController);
case Blueprint:
return new BlueprintResourceProvider(propertyIds, keyPropertyIds, managementController);
+ case Recommendation:
+ return new RecommendationResourceProvider(propertyIds, keyPropertyIds, managementController);
+ case Validation:
+ return new ValidationResourceProvider(propertyIds, keyPropertyIds, managementController);
+ case Alert:
+ return new AlertResourceProvider(propertyIds, keyPropertyIds, managementController);
+ case ClientConfig:
+ return new ClientConfigResourceProvider(propertyIds, keyPropertyIds, managementController);
default:
throw new IllegalArgumentException("Unknown type " + type);
}
@@ -161,34 +170,4 @@ public abstract class AbstractControllerResourceProvider extends AbstractResourc
ensureResourceProvider(type);
}
- /**
- * Extracting given query_parameter value from the predicate
- * @param queryParameterId query parameter id
- * @param predicate predicate
- * @return the query parameter
- */
- protected static Object getQueryParameterValue(String queryParameterId, Predicate predicate) {
-
- Object result = null;
-
- if (predicate instanceof ArrayPredicate) {
- ArrayPredicate arrayPredicate = (ArrayPredicate) predicate;
- for (Predicate predicateItem : arrayPredicate.getPredicates()) {
- if (predicateItem instanceof EqualsPredicate) {
- EqualsPredicate equalsPredicate =
- (EqualsPredicate) predicateItem;
- if (queryParameterId.equals(equalsPredicate.getPropertyId())) {
- return equalsPredicate.getValue();
- }
- } else {
- result = getQueryParameterValue(queryParameterId, predicateItem);
- if (result != null) {
- return result;
- }
- }
- }
-
- }
- return result;
- }
}