You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2013/11/08 23:25:07 UTC
[5/5] git commit: AMBARI-3728. Remove unused config code from Service,
Component, HostComponent (ncole)
AMBARI-3728. Remove unused config code from Service, Component, HostComponent (ncole)
Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/471403cd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/471403cd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/471403cd
Branch: refs/heads/trunk
Commit: 471403cd51feafa74088360b32f297766ea8d64f
Parents: 8b3af9a
Author: Nate Cole <nc...@hortonworks.com>
Authored: Fri Nov 8 14:52:49 2013 -0500
Committer: Nate Cole <nc...@hortonworks.com>
Committed: Fri Nov 8 17:15:04 2013 -0500
----------------------------------------------------------------------
.../ambari/server/agent/HeartbeatMonitor.java | 8 -
.../AmbariManagementControllerImpl.java | 62 +-
.../controller/ServiceComponentHostRequest.java | 27 +-
.../ServiceComponentHostResponse.java | 31 +-
.../controller/ServiceComponentRequest.java | 21 +-
.../controller/ServiceComponentResponse.java | 20 -
.../server/controller/ServiceRequest.java | 32 +-
.../server/controller/ServiceResponse.java | 19 -
.../internal/AbstractProviderModule.java | 2 +-
.../internal/ComponentResourceProvider.java | 100 +--
.../internal/ConfigurationResourceProvider.java | 20 -
.../internal/HostComponentResourceProvider.java | 41 +-
.../internal/HostResourceProvider.java | 2 +-
.../internal/ServiceResourceProvider.java | 114 +--
.../orm/dao/ComponentConfigMappingDAO.java | 97 --
.../orm/dao/HostComponentConfigMappingDAO.java | 107 ---
.../HostComponentDesiredConfigMappingDAO.java | 107 ---
.../server/orm/dao/ServiceConfigMappingDAO.java | 93 --
.../orm/entities/ClusterConfigEntity.java | 44 -
.../orm/entities/ClusterServiceEntity.java | 13 -
.../entities/ComponentConfigMappingEntity.java | 161 ----
.../ComponentConfigMappingEntityPK.java | 102 ---
.../HostComponentConfigMappingEntity.java | 176 ----
.../HostComponentConfigMappingEntityPK.java | 108 ---
...HostComponentDesiredConfigMappingEntity.java | 176 ----
...stComponentDesiredConfigMappingEntityPK.java | 108 ---
.../HostComponentDesiredStateEntity.java | 11 -
.../orm/entities/HostComponentStateEntity.java | 12 -
.../ServiceComponentDesiredStateEntity.java | 10 -
.../entities/ServiceConfigMappingEntity.java | 147 ---
.../entities/ServiceConfigMappingEntityPK.java | 81 --
.../org/apache/ambari/server/state/Service.java | 4 -
.../ambari/server/state/ServiceComponent.java | 10 +-
.../server/state/ServiceComponentHost.java | 15 +-
.../server/state/ServiceComponentHostEvent.java | 32 +-
.../server/state/ServiceComponentImpl.java | 121 +--
.../apache/ambari/server/state/ServiceImpl.java | 123 +--
.../org/apache/ambari/server/state/State.java | 79 +-
.../svccomphost/ServiceComponentHostImpl.java | 334 +------
.../ServiceComponentHostStartEvent.java | 6 +-
.../main/resources/Ambari-DDL-MySQL-CREATE.sql | 12 -
.../main/resources/Ambari-DDL-Oracle-CREATE.sql | 12 -
.../resources/Ambari-DDL-Postgres-CREATE.sql | 20 -
.../Ambari-DDL-Postgres-REMOTE-CREATE.sql | 12 -
.../src/main/resources/META-INF/persistence.xml | 41 -
.../src/main/resources/properties.json | 4 -
.../ExecutionCommandWrapperTest.java | 3 +-
.../actionmanager/TestActionDBAccessorImpl.java | 18 +-
.../server/actionmanager/TestActionManager.java | 3 +-
.../server/agent/TestHeartbeatHandler.java | 3 +-
.../AmbariManagementControllerImplTest.java | 85 +-
.../AmbariManagementControllerTest.java | 895 +++++++------------
.../internal/AbstractResourceProviderTest.java | 20 +-
.../internal/ComponentResourceProviderTest.java | 24 +-
.../HostComponentResourceProviderTest.java | 11 +-
.../internal/HostResourceProviderTest.java | 24 +-
.../internal/JMXHostProviderTest.java | 10 +-
.../controller/internal/RequestImplTest.java | 4 -
.../internal/ServiceResourceProviderTest.java | 86 +-
.../server/stageplanner/TestStagePlanner.java | 48 +-
.../server/state/cluster/ClusterTest.java | 1 -
.../server/state/cluster/ClustersTest.java | 6 -
.../svccomphost/ServiceComponentHostTest.java | 167 +---
63 files changed, 632 insertions(+), 3653 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/471403cd/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java
index 43961b2..3de0cff 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/agent/HeartbeatMonitor.java
@@ -219,14 +219,6 @@ public class HeartbeatMonitor implements Runnable {
configurations.put("global", props);
}
- // HACK - if any service exists with global tag, and we have none, use
- // that instead
- if (configurations.isEmpty()) {
- Config config = service.getDesiredConfigs().get("global");
- if (null != config)
- configurations.put("global", new HashMap<String, String>(config.getProperties()));
- }
-
StatusCommand statusCmd = new StatusCommand();
statusCmd.setClusterName(cl.getClusterName());
statusCmd.setServiceName(serviceName);
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/471403cd/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 5132c5a..1fc1222 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
@@ -467,12 +467,6 @@ public class AmbariManagementControllerImpl implements
sch.setDesiredStackVersion(sc.getDesiredStackVersion());
- // TODO fix config versions to configs conversion
- Map<String, Config> configs = new HashMap<String, Config>();
- if (request.getConfigVersions() != null) {
- }
-
- sch.updateDesiredConfigs(configs);
sc.addServiceComponentHost(sch);
sch.persist();
}
@@ -1235,7 +1229,7 @@ public class AmbariManagementControllerImpl implements
roleCommand = RoleCommand.START;
event = new ServiceComponentHostStartEvent(
scHost.getServiceComponentName(), scHost.getHostName(),
- nowTimestamp, scHost.getDesiredConfigVersionsRecursive());
+ nowTimestamp);
} else {
String error = "Invalid transition for"
+ " servicecomponenthost"
@@ -1260,7 +1254,7 @@ public class AmbariManagementControllerImpl implements
roleCommand = RoleCommand.UNINSTALL;
event = new ServiceComponentHostStartEvent(
scHost.getServiceComponentName(), scHost.getHostName(),
- nowTimestamp, scHost.getDesiredConfigVersionsRecursive());
+ nowTimestamp);
} else {
throw new AmbariException("Invalid transition for"
+ " servicecomponenthost"
@@ -1547,27 +1541,6 @@ public class AmbariManagementControllerImpl implements
}
}
- if (request.getConfigVersions() != null) {
- State.checkUpdateConfiguration(sch, oldState, newState);
-
- for (Entry<String, String> entry :
- request.getConfigVersions().entrySet()) {
- Config config = cluster.getConfig(
- entry.getKey(), entry.getValue());
- if (null == config) {
- throw new AmbariException("Trying to update servicecomponenthost"
- + " with invalid configs"
- + ", clusterName=" + cluster.getClusterName()
- + ", clusterId=" + cluster.getClusterId()
- + ", serviceName=" + s.getName()
- + ", componentName=" + sc.getName()
- + ", hostname=" + sch.getHostName()
- + ", invalidConfigType=" + entry.getKey()
- + ", invalidConfigTag=" + entry.getValue());
- }
- }
- }
-
// If upgrade request comes without state information then its an error
boolean upgradeRequest = checkIfUpgradeRequestAndValidate(request, cluster, s, sc, sch);
@@ -1692,29 +1665,6 @@ public class AmbariManagementControllerImpl implements
+ " state changes for a set of service components at the same time");
}
- // TODO additional validation?
- for (ServiceComponentHostRequest request : requests) {
- Cluster cluster = clusters.getCluster(request.getClusterName());
- Service s = cluster.getService(request.getServiceName());
- ServiceComponent sc = s.getServiceComponent(
- request.getComponentName());
- ServiceComponentHost sch = sc.getServiceComponentHost(
- request.getHostname());
- if (request.getConfigVersions() != null) {
- Map<String, Config> updated = new HashMap<String, Config>();
-
- for (Entry<String, String> entry : request.getConfigVersions().entrySet()) {
- Config config = cluster.getConfig(
- entry.getKey(), entry.getValue());
- updated.put(config.getType(), config);
-
- if (!updated.isEmpty()) {
- sch.updateDesiredConfigs(updated);
- }
- }
- }
- }
-
// Perform direct transitions (without task generation)
for (Entry<ServiceComponentHost, State> entry : directTransitionScHosts.entrySet()) {
ServiceComponentHost componentHost = entry.getKey();
@@ -1851,11 +1801,7 @@ public class AmbariManagementControllerImpl implements
throw getHostComponentUpgradeException(request, cluster, s, sc, sch,
"Component host is in an invalid state for upgrade");
}
- // Ensure that the request only updates the stack id
- if (request.getConfigVersions() != null) {
- throw getHostComponentUpgradeException(request, cluster, s, sc, sch,
- "Upgrade cannot be accompanied with config modification");
- }
+
if (request.getDesiredState() == null
|| !request.getDesiredState().equals(State.INSTALLED.toString())) {
throw getHostComponentUpgradeException(request, cluster, s, sc, sch,
@@ -1952,7 +1898,7 @@ public class AmbariManagementControllerImpl implements
for (ServiceComponentHost sch : cluster.getServiceComponentHosts(request.getHostname())) {
ServiceComponentHostRequest schr = new ServiceComponentHostRequest(request.getClusterName(),
- sch.getServiceName(), sch.getServiceComponentName(), sch.getHostName(), null, null);
+ sch.getServiceName(), sch.getServiceComponentName(), sch.getHostName(), null);
expanded.add(schr);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/471403cd/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java
index 2169760..7cfc489 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostRequest.java
@@ -18,7 +18,7 @@
package org.apache.ambari.server.controller;
-import java.util.Map;
+
public class ServiceComponentHostRequest {
@@ -30,23 +30,20 @@ public class ServiceComponentHostRequest {
private String hostname;
- // Config type -> version mapping
- private Map<String, String> configVersions; // CREATE/UPDATE
-
private String desiredState; // CREATE/UPDATE
private String desiredStackId; // UPDATE
-
+
public ServiceComponentHostRequest(String clusterName,
String serviceName,
- String componentName, String hostname,
- Map<String, String> configVersions, String desiredState) {
+ String componentName,
+ String hostname,
+ String desiredState) {
super();
this.clusterName = clusterName;
this.serviceName = serviceName;
this.componentName = componentName;
this.hostname = hostname;
- this.configVersions = configVersions;
this.desiredState = desiredState;
}
@@ -93,20 +90,6 @@ public class ServiceComponentHostRequest {
}
/**
- * @return the configVersions
- */
- public Map<String, String> getConfigVersions() {
- return configVersions;
- }
-
- /**
- * @param configVersions the configVersions to set
- */
- public void setConfigVersions(Map<String, String> configVersions) {
- this.configVersions = configVersions;
- }
-
- /**
* @return the desiredState
*/
public String getDesiredState() {
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/471403cd/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostResponse.java
index 0448864..d746733 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentHostResponse.java
@@ -33,11 +33,6 @@ public class ServiceComponentHostResponse {
private String hostname;
- // Config type -> version mapping
- private Map<String, String> configs;
-
- private Map<String, String> desiredConfigs;
-
// type -> desired config
private Map<String, HostConfig> actualConfigs;
@@ -54,17 +49,13 @@ public class ServiceComponentHostResponse {
public ServiceComponentHostResponse(String clusterName, String serviceName,
String componentName, String hostname,
- Map<String, String> configVersions,
- Map<String, String> desiredConfigs,
- String liveState, String stackVersion,
+ String liveState,
+ String stackVersion,
String desiredState, String desiredStackVersion) {
- super();
this.clusterName = clusterName;
this.serviceName = serviceName;
this.componentName = componentName;
this.hostname = hostname;
- this.configs = configVersions;
- this.desiredConfigs = desiredConfigs;
this.liveState = liveState;
this.stackVersion = stackVersion;
this.desiredState = desiredState;
@@ -114,20 +105,6 @@ public class ServiceComponentHostResponse {
}
/**
- * @return the configVersions
- */
- public Map<String, String> getConfigs() {
- return configs;
- }
-
- /**
- * @param configVersions the configVersions to set
- */
- public void setConfigs(Map<String, String> configVersions) {
- this.configs = configVersions;
- }
-
- /**
* @return the liveState
*/
public String getLiveState() {
@@ -234,10 +211,6 @@ public class ServiceComponentHostResponse {
return result;
}
- public Map<String, String> getDesiredConfigs() {
- return desiredConfigs;
- }
-
/**
* @param configs the actual configs
*/
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/471403cd/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java
index 277a00f..23e5949 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentRequest.java
@@ -18,7 +18,6 @@
package org.apache.ambari.server.controller;
-import java.util.Map;
public class ServiceComponentRequest {
@@ -28,19 +27,15 @@ public class ServiceComponentRequest {
private String componentName; // GET/CREATE/UPDATE/DELETE
- // Config type -> version mapping
- private Map<String, String> configVersions; // CREATE/UPDATE
-
private String desiredState; // CREATE/UPDATE
public ServiceComponentRequest(String clusterName,
String serviceName, String componentName,
- Map<String, String> configVersions, String desiredState) {
+ String desiredState) {
super();
this.clusterName = clusterName;
this.serviceName = serviceName;
this.componentName = componentName;
- this.configVersions = configVersions;
this.desiredState = desiredState;
}
@@ -73,20 +68,6 @@ public class ServiceComponentRequest {
}
/**
- * @return the configVersions
- */
- public Map<String, String> getConfigVersions() {
- return configVersions;
- }
-
- /**
- * @param configVersions the configVersions to set
- */
- public void setConfigVersions(Map<String, String> configVersions) {
- this.configVersions = configVersions;
- }
-
- /**
* @return the desiredState
*/
public String getDesiredState() {
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/471403cd/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentResponse.java
index 6365c40..f577255 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentResponse.java
@@ -18,7 +18,6 @@
package org.apache.ambari.server.controller;
-import java.util.Map;
public class ServiceComponentResponse {
@@ -30,9 +29,6 @@ public class ServiceComponentResponse {
private String componentName;
- // Config type -> version mapping
- private Map<String, String> configVersions;
-
private String desiredStackVersion;
private String desiredState;
@@ -42,7 +38,6 @@ public class ServiceComponentResponse {
public ServiceComponentResponse(Long clusterId, String clusterName,
String serviceName,
String componentName,
- Map<String, String> configVersions,
String desiredStackVersion,
String desiredState) {
super();
@@ -50,7 +45,6 @@ public class ServiceComponentResponse {
this.clusterName = clusterName;
this.serviceName = serviceName;
this.componentName = componentName;
- this.configVersions = configVersions;
this.desiredStackVersion = desiredStackVersion;
this.desiredState = desiredState;
}
@@ -84,20 +78,6 @@ public class ServiceComponentResponse {
}
/**
- * @return the configVersions
- */
- public Map<String, String> getConfigVersions() {
- return configVersions;
- }
-
- /**
- * @param configVersions the configVersions to set
- */
- public void setConfigVersions(Map<String, String> configVersions) {
- this.configVersions = configVersions;
- }
-
- /**
* @return the clusterId
*/
public Long getClusterId() {
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/471403cd/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceRequest.java
index b2c8c73..03ea6a9 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceRequest.java
@@ -17,8 +17,6 @@
*/
package org.apache.ambari.server.controller;
-import java.util.Map;
-import java.util.Map.Entry;
public class ServiceRequest {
@@ -26,17 +24,13 @@ public class ServiceRequest {
private String serviceName; // GET/CREATE/UPDATE/DELETE
- // Config type -> version mapping
- private Map<String, String> configVersions; // CREATE/UPDATE
-
private String desiredState; // CREATE/UPDATE
public ServiceRequest(String clusterName, String serviceName,
- Map<String, String> configVersions, String desiredState) {
+ String desiredState) {
super();
this.clusterName = clusterName;
this.serviceName = serviceName;
- this.configVersions = configVersions;
this.desiredState = desiredState;
}
@@ -55,20 +49,6 @@ public class ServiceRequest {
}
/**
- * @return the configVersions
- */
- public Map<String, String> getConfigVersions() {
- return configVersions;
- }
-
- /**
- * @param configVersions the configVersions to set
- */
- public void setConfigVersions(Map<String, String> configVersions) {
- this.configVersions = configVersions;
- }
-
- /**
* @return the desiredState
*/
public String getDesiredState() {
@@ -100,15 +80,7 @@ public class ServiceRequest {
StringBuilder sb = new StringBuilder();
sb.append("clusterName=" + clusterName
+ ", serviceName=" + serviceName
- + ", desiredState=" + desiredState
- + ", configs=[ ");
- if (configVersions != null) {
- for (Entry<String, String> entry : configVersions.entrySet()) {
- sb.append("{ type=" + entry.getKey()
- + ", versionTag=" + entry.getValue() + "}, ");
- }
- }
- sb.append(" ]");
+ + ", desiredState=" + desiredState);
return sb.toString();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/471403cd/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceResponse.java
index 64dc8e7..82b61e8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceResponse.java
@@ -32,18 +32,13 @@ public class ServiceResponse {
private String desiredState;
- // Config type -> version mapping
- private Map<String, String> configVersions;
-
public ServiceResponse(Long clusterId, String clusterName,
String serviceName,
- Map<String, String> configVersions,
String desiredStackVersion, String desiredState) {
super();
this.clusterId = clusterId;
this.clusterName = clusterName;
this.serviceName = serviceName;
- this.configVersions = configVersions;
this.setDesiredStackVersion(desiredStackVersion);
this.setDesiredState(desiredState);
}
@@ -63,20 +58,6 @@ public class ServiceResponse {
}
/**
- * @return the configVersions
- */
- public Map<String, String> getConfigVersions() {
- return configVersions;
- }
-
- /**
- * @param configVersions the configVersions to set
- */
- public void setConfigVersions(Map<String, String> configVersions) {
- this.configVersions = configVersions;
- }
-
- /**
* @return the clusterId
*/
public Long getClusterId() {
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/471403cd/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
index 8005153..d025f48 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java
@@ -290,7 +290,7 @@ public abstract class AbstractProviderModule implements ProviderModule, Resource
ServiceComponentHostRequest componentRequest = new ServiceComponentHostRequest(clusterName, "GANGLIA",
Role.GANGLIA_SERVER.name(),
gangliaCollectorHostName,
- Collections.<String, String>emptyMap(), null);
+ null);
Set<ServiceComponentHostResponse> hostComponents =
managementController.getHostComponents(Collections.singleton(componentRequest));
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/471403cd/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
index 521e054..9c1f099 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
@@ -17,6 +17,15 @@
*/
package org.apache.ambari.server.controller.internal;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.ClusterNotFoundException;
import org.apache.ambari.server.DuplicateResourceException;
@@ -29,12 +38,18 @@ import org.apache.ambari.server.controller.AmbariManagementController;
import org.apache.ambari.server.controller.RequestStatusResponse;
import org.apache.ambari.server.controller.ServiceComponentRequest;
import org.apache.ambari.server.controller.ServiceComponentResponse;
-import org.apache.ambari.server.controller.spi.*;
-import org.apache.ambari.server.controller.utilities.PropertyHelper;
+import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
+import org.apache.ambari.server.controller.spi.NoSuchResourceException;
+import org.apache.ambari.server.controller.spi.Predicate;
+import org.apache.ambari.server.controller.spi.Request;
+import org.apache.ambari.server.controller.spi.RequestStatus;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException;
+import org.apache.ambari.server.controller.spi.SystemException;
+import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.ComponentInfo;
-import org.apache.ambari.server.state.Config;
import org.apache.ambari.server.state.Service;
import org.apache.ambari.server.state.ServiceComponent;
import org.apache.ambari.server.state.ServiceComponentFactory;
@@ -42,15 +57,6 @@ import org.apache.ambari.server.state.ServiceComponentHost;
import org.apache.ambari.server.state.StackId;
import org.apache.ambari.server.state.State;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
/**
* Resource provider for component resources.
*/
@@ -64,7 +70,6 @@ class ComponentResourceProvider extends AbstractControllerResourceProvider {
protected static final String COMPONENT_SERVICE_NAME_PROPERTY_ID = "ServiceComponentInfo/service_name";
protected static final String COMPONENT_COMPONENT_NAME_PROPERTY_ID = "ServiceComponentInfo/component_name";
protected static final String COMPONENT_STATE_PROPERTY_ID = "ServiceComponentInfo/state";
- protected static final String COMPONENT_DESIRED_CONFIGS_PROPERTY_ID = "ServiceComponentInfo/desired_configs";
protected static final String COMPONENT_CATEGORY_PROPERTY_ID = "ServiceComponentInfo/category";
//Parameters from the predicate
@@ -148,8 +153,6 @@ class ComponentResourceProvider extends AbstractControllerResourceProvider {
setResourceProperty(resource, COMPONENT_COMPONENT_NAME_PROPERTY_ID, response.getComponentName(), requestedIds);
setResourceProperty(resource, COMPONENT_STATE_PROPERTY_ID,
response.getDesiredState(), requestedIds);
- setResourceProperty(resource, COMPONENT_DESIRED_CONFIGS_PROPERTY_ID,
- response.getConfigVersions(), requestedIds);
setResourceProperty(resource, COMPONENT_CATEGORY_PROPERTY_ID, response.getCategory(), requestedIds);
resources.add(resource);
@@ -164,17 +167,6 @@ class ComponentResourceProvider extends AbstractControllerResourceProvider {
final Set<ServiceComponentRequest> requests = new HashSet<ServiceComponentRequest>();
for (Map<String, Object> propertyMap : getPropertyMaps(request.getProperties().iterator().next(), predicate)) {
ServiceComponentRequest compRequest = getRequest(propertyMap);
- Map<String, String> configMap = new HashMap<String,String>();
-
- for (Map.Entry<String,Object> entry : propertyMap.entrySet()) {
- String propertyCategory = PropertyHelper.getPropertyCategory(entry.getKey());
- if (propertyCategory != null && propertyCategory.equals("config")) {
- configMap.put(PropertyHelper.getPropertyName(entry.getKey()), (String) entry.getValue());
- }
- }
-
- if (0 != configMap.size())
- compRequest.setConfigVersions(configMap);
requests.add(compRequest);
}
@@ -232,7 +224,6 @@ class ComponentResourceProvider extends AbstractControllerResourceProvider {
(String) properties.get(COMPONENT_CLUSTER_NAME_PROPERTY_ID),
(String) properties.get(COMPONENT_SERVICE_NAME_PROPERTY_ID),
(String) properties.get(COMPONENT_COMPONENT_NAME_PROPERTY_ID),
- null,
(String) properties.get(COMPONENT_STATE_PROPERTY_ID));
}
@@ -406,12 +397,6 @@ class ComponentResourceProvider extends AbstractControllerResourceProvider {
sc.setDesiredState(s.getDesiredState());
}
- // FIXME fix config versions to configs conversion
- Map<String, Config> configs = new HashMap<String, Config>();
- if (request.getConfigVersions() != null) {
- }
-
- sc.updateDesiredConfigs(configs);
s.addServiceComponent(sc);
sc.persist();
}
@@ -660,27 +645,6 @@ class ComponentResourceProvider extends AbstractControllerResourceProvider {
}
}
- if (request.getConfigVersions() != null) {
- State.checkUpdateConfiguration(sc, newState);
-
- for (Map.Entry<String,String> entry :
- request.getConfigVersions().entrySet()) {
- Config config = cluster.getConfig(
- entry.getKey(), entry.getValue());
- if (null == config) {
- // throw error for invalid config
- throw new AmbariException("Trying to update servicecomponent with"
- + " invalid configs"
- + ", clusterName=" + cluster.getClusterName()
- + ", clusterId=" + cluster.getClusterId()
- + ", serviceName=" + s.getName()
- + ", componentName=" + sc.getName()
- + ", invalidConfigType=" + entry.getKey()
- + ", invalidConfigTag=" + entry.getValue());
- }
- }
- }
-
if (newState == null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Nothing to do for new updateServiceComponent request"
@@ -798,34 +762,6 @@ class ComponentResourceProvider extends AbstractControllerResourceProvider {
// TODO if all components reach a common state, should service state be
// modified?
-
- for (ServiceComponentRequest request : requests) {
- Cluster cluster = clusters.getCluster(request.getClusterName());
- Service s = cluster.getService(request.getServiceName());
- ServiceComponent sc = s.getServiceComponent(
- request.getComponentName());
- if (request.getConfigVersions() != null) {
- Map<String, Config> updated = new HashMap<String, Config>();
-
- for (Map.Entry<String,String> entry :
- request.getConfigVersions().entrySet()) {
- Config config = cluster.getConfig(
- entry.getKey(), entry.getValue());
- updated.put(config.getType(), config);
- }
-
- if (!updated.isEmpty()) {
- sc.updateDesiredConfigs(updated);
- for (ServiceComponentHost sch :
- sc.getServiceComponentHosts().values()) {
- sch.deleteDesiredConfigs(updated.keySet());
- sch.persist();
- }
- sc.persist();
- }
- }
- }
-
Cluster cluster = clusters.getCluster(clusterNames.iterator().next());
return getManagementController().createStages(cluster, requestProperties, null, null, changedComps, changedScHosts,
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/471403cd/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProvider.java
index c40ad68..60a3780 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProvider.java
@@ -213,26 +213,6 @@ public class ConfigurationResourceProvider extends
// ----- utility methods ---------------------------------------------------
/**
- * Get the config related property ids from the given map of property ids.
- *
- * @param propertyIdMap the map of property ids
- *
- * @return a subset of the given map containing olny the property ids that have a
- * category of "config"
- */
- public static Map<String, String> getConfigPropertyValues(Map<String, Object> propertyIdMap) {
- Map<String, String> configMap = new HashMap<String, String>();
-
- for (Map.Entry<String,Object> entry : propertyIdMap.entrySet()) {
- String propertyId = entry.getKey();
- if (PropertyHelper.getPropertyCategory(propertyId).equals("config")) {
- configMap.put(PropertyHelper.getPropertyName(propertyId), (String) entry.getValue());
- }
- }
- return configMap;
- }
-
- /**
* Get a configuration request object from the given map of properties.
*
* @param properties the map of properties
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/471403cd/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
index eb419f3..f0b3c5b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
@@ -17,23 +17,31 @@
*/
package org.apache.ambari.server.controller.internal;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.configuration.ComponentSSLConfiguration;
import org.apache.ambari.server.controller.AmbariManagementController;
import org.apache.ambari.server.controller.RequestStatusResponse;
import org.apache.ambari.server.controller.ServiceComponentHostRequest;
import org.apache.ambari.server.controller.ServiceComponentHostResponse;
-import org.apache.ambari.server.controller.spi.*;
+import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
+import org.apache.ambari.server.controller.spi.NoSuchResourceException;
+import org.apache.ambari.server.controller.spi.Predicate;
+import org.apache.ambari.server.controller.spi.PropertyProvider;
+import org.apache.ambari.server.controller.spi.Request;
+import org.apache.ambari.server.controller.spi.RequestStatus;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException;
+import org.apache.ambari.server.controller.spi.SystemException;
+import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
import org.apache.ambari.server.controller.utilities.PropertyHelper;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import org.apache.ambari.server.Role;
-
/**
* Resource provider for host component resources.
*/
@@ -54,10 +62,6 @@ class HostComponentResourceProvider extends AbstractControllerResourceProvider {
= PropertyHelper.getPropertyId("HostRoles", "state");
protected static final String HOST_COMPONENT_DESIRED_STATE_PROPERTY_ID
= PropertyHelper.getPropertyId("HostRoles", "desired_state");
- protected static final String HOST_COMPONENT_CONFIGS_PROPERTY_ID
- = PropertyHelper.getPropertyId("HostRoles", "configs");
- protected static final String HOST_COMPONENT_DESIRED_CONFIGS_PROPERTY_ID
- = PropertyHelper.getPropertyId("HostRoles", "desired_configs");
protected static final String HOST_COMPONENT_STACK_ID_PROPERTY_ID
= PropertyHelper.getPropertyId("HostRoles", "stack_id");
protected static final String HOST_COMPONENT_DESIRED_STACK_ID_PROPERTY_ID
@@ -174,10 +178,6 @@ class HostComponentResourceProvider extends AbstractControllerResourceProvider {
response.getStackVersion(), requestedIds);
setResourceProperty(resource, HOST_COMPONENT_DESIRED_STACK_ID_PROPERTY_ID,
response.getDesiredStackVersion(), requestedIds);
- setResourceProperty(resource, HOST_COMPONENT_CONFIGS_PROPERTY_ID,
- response.getConfigs(), requestedIds);
- setResourceProperty(resource, HOST_COMPONENT_DESIRED_CONFIGS_PROPERTY_ID,
- response.getDesiredConfigs(), requestedIds);
setResourceProperty(resource, HOST_COMPONENT_ACTUAL_CONFIGS_PROPERTY_ID,
response.getActualConfigs(), requestedIds);
setResourceProperty(resource, HOST_COMPONENT_STALE_CONFIGS_PROPERTY_ID,
@@ -282,17 +282,10 @@ class HostComponentResourceProvider extends AbstractControllerResourceProvider {
(String) properties.get(HOST_COMPONENT_SERVICE_NAME_PROPERTY_ID),
(String) properties.get(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID),
(String) properties.get(HOST_COMPONENT_HOST_NAME_PROPERTY_ID),
- null,
(String) properties.get(HOST_COMPONENT_STATE_PROPERTY_ID));
serviceComponentHostRequest.setDesiredStackId(
(String) properties.get(HOST_COMPONENT_STACK_ID_PROPERTY_ID));
- Map<String, String> configMappings =
- ConfigurationResourceProvider.getConfigPropertyValues(properties);
-
- if (configMappings.size() > 0) {
- serviceComponentHostRequest.setConfigVersions(configMappings);
- }
return serviceComponentHostRequest;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/471403cd/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
index 30394d9..f245888 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
@@ -677,7 +677,7 @@ class HostResourceProvider extends AbstractControllerResourceProvider {
StackId stackId = cluster.getDesiredStackVersion();
ServiceComponentHostRequest request = new ServiceComponentHostRequest(clusterName,
- null, null, response.getHostname(), null, null);
+ null, null, response.getHostname(), null);
Set<ServiceComponentHostResponse> hostComponentResponses =
controller.getHostComponents(Collections.singleton(request));
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/471403cd/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
index 2ef6005..f527f43 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
@@ -17,6 +17,17 @@
*/
package org.apache.ambari.server.controller.internal;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
import org.apache.ambari.server.AmbariException;
import org.apache.ambari.server.ClusterNotFoundException;
import org.apache.ambari.server.DuplicateResourceException;
@@ -30,7 +41,15 @@ import org.apache.ambari.server.controller.ServiceComponentHostRequest;
import org.apache.ambari.server.controller.ServiceComponentHostResponse;
import org.apache.ambari.server.controller.ServiceRequest;
import org.apache.ambari.server.controller.ServiceResponse;
-import org.apache.ambari.server.controller.spi.*;
+import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
+import org.apache.ambari.server.controller.spi.NoSuchResourceException;
+import org.apache.ambari.server.controller.spi.Predicate;
+import org.apache.ambari.server.controller.spi.Request;
+import org.apache.ambari.server.controller.spi.RequestStatus;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException;
+import org.apache.ambari.server.controller.spi.SystemException;
+import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
import org.apache.ambari.server.controller.utilities.PropertyHelper;
import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
@@ -44,17 +63,6 @@ import org.apache.ambari.server.state.StackId;
import org.apache.ambari.server.state.State;
import org.apache.commons.lang.StringUtils;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
/**
* Resource provider for service resources.
*/
@@ -67,7 +75,6 @@ class ServiceResourceProvider extends AbstractControllerResourceProvider {
protected static final String SERVICE_CLUSTER_NAME_PROPERTY_ID = PropertyHelper.getPropertyId("ServiceInfo", "cluster_name");
protected static final String SERVICE_SERVICE_NAME_PROPERTY_ID = PropertyHelper.getPropertyId("ServiceInfo", "service_name");
protected static final String SERVICE_SERVICE_STATE_PROPERTY_ID = PropertyHelper.getPropertyId("ServiceInfo", "state");
- protected static final String SERVICE_DESIRED_CONFIGS_PROPERTY_ID = PropertyHelper.getPropertyId("ServiceInfo", "desired_configs");
//Parameters from the predicate
private static final String QUERY_PARAMETERS_RUN_SMOKE_TEST_ID =
@@ -157,8 +164,6 @@ class ServiceResourceProvider extends AbstractControllerResourceProvider {
response.getClusterName(), requestedIds);
setResourceProperty(resource, SERVICE_SERVICE_NAME_PROPERTY_ID,
response.getServiceName(), requestedIds);
- setResourceProperty(resource, SERVICE_DESIRED_CONFIGS_PROPERTY_ID,
- response.getConfigVersions(), requestedIds);
setResourceProperty(resource, SERVICE_SERVICE_STATE_PROPERTY_ID,
calculateServiceState(response.getClusterName(), response.getServiceName()),
requestedIds);
@@ -259,15 +264,8 @@ class ServiceResourceProvider extends AbstractControllerResourceProvider {
ServiceRequest svcRequest = new ServiceRequest(
(String) properties.get(SERVICE_CLUSTER_NAME_PROPERTY_ID),
(String) properties.get(SERVICE_SERVICE_NAME_PROPERTY_ID),
- null,
(String) properties.get(SERVICE_SERVICE_STATE_PROPERTY_ID));
- Map<String, String> configMappings =
- ConfigurationResourceProvider.getConfigPropertyValues(properties);
-
- if (configMappings.size() > 0) {
- svcRequest.setConfigVersions(configMappings);
- }
return svcRequest;
}
@@ -387,16 +385,12 @@ class ServiceResourceProvider extends AbstractControllerResourceProvider {
for (ServiceRequest request : requests) {
Cluster cluster = clusters.getCluster(request.getClusterName());
- // FIXME initialize configs based off service.configVersions
- Map<String, Config> configs = new HashMap<String, Config>();
-
State state = State.INIT;
// Already checked that service does not exist
Service s = serviceFactory.createNew(cluster, request.getServiceName());
s.setDesiredState(state);
- s.updateDesiredConfigs(configs);
s.setDesiredStackVersion(cluster.getDesiredStackVersion());
cluster.addService(s);
s.persist();
@@ -543,34 +537,6 @@ class ServiceResourceProvider extends AbstractControllerResourceProvider {
}
}
- if (request.getConfigVersions() != null) {
- State.checkUpdateConfiguration(s, newState);
-
- for (Map.Entry<String,String> entry :
- request.getConfigVersions().entrySet()) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Attaching config to service"
- + ", clusterName=" + cluster.getClusterName()
- + ", serviceName=" + s.getName()
- + ", configType=" + entry.getKey()
- + ", configTag=" + entry.getValue());
- }
- Config config = cluster.getConfig(
- entry.getKey(), entry.getValue());
- if (null == config) {
- // throw error for invalid config
- throw new AmbariException("Trying to update service with"
- + " invalid configs"
- + ", clusterName=" + cluster.getClusterName()
- + ", clusterId=" + cluster.getClusterId()
- + ", serviceName=" + s.getName()
- + ", invalidConfigType=" + entry.getKey()
- + ", invalidConfigTag=" + entry.getValue());
- }
- }
- }
-
-
if (newState == null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Nothing to do for new updateService request"
@@ -718,40 +684,6 @@ class ServiceResourceProvider extends AbstractControllerResourceProvider {
+ " changes for a set of services at the same time");
}
- for (ServiceRequest request : requests) {
- Cluster cluster = clusters.getCluster(request.getClusterName());
- Service s = cluster.getService(request.getServiceName());
- if (request.getConfigVersions() != null) {
- Map<String, Config> updated = new HashMap<String, Config>();
-
- for (Map.Entry<String,String> entry : request.getConfigVersions().entrySet()) {
- Config config = cluster.getConfig(entry.getKey(), entry.getValue());
- updated.put(config.getType(), config);
- }
-
- if (!updated.isEmpty()) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Updating service configs, attaching configs"
- + ", clusterName=" + request.getClusterName()
- + ", serviceName=" + s.getName()
- + ", configCount=" + updated.size());
- }
- s.updateDesiredConfigs(updated);
- s.persist();
- }
-
- for (ServiceComponent sc : s.getServiceComponents().values()) {
- sc.deleteDesiredConfigs(updated.keySet());
- for (ServiceComponentHost sch :
- sc.getServiceComponentHosts().values()) {
- sch.deleteDesiredConfigs(updated.keySet());
- sch.persist();
- }
- sc.persist();
- }
- }
- }
-
Cluster cluster = clusters.getCluster(clusterNames.iterator().next());
return controller.createStages(cluster, requestProperties, null, changedServices, changedComps, changedScHosts,
@@ -820,7 +752,7 @@ class ServiceResourceProvider extends AbstractControllerResourceProvider {
StackId stackId = cluster.getDesiredStackVersion();
ServiceComponentHostRequest request = new ServiceComponentHostRequest(clusterName,
- serviceName, null, null, null, null);
+ serviceName, null, null, null);
Set<ServiceComponentHostResponse> hostComponentResponses =
controller.getHostComponents(Collections.singleton(request));
@@ -870,7 +802,7 @@ class ServiceResourceProvider extends AbstractControllerResourceProvider {
StackId stackId = cluster.getDesiredStackVersion();
ServiceComponentHostRequest request = new ServiceComponentHostRequest(clusterName,
- serviceName, null, null, null, null);
+ serviceName, null, null, null);
Set<ServiceComponentHostResponse> hostComponentResponses =
controller.getHostComponents(Collections.singleton(request));
@@ -949,7 +881,7 @@ class ServiceResourceProvider extends AbstractControllerResourceProvider {
StackId stackId = cluster.getDesiredStackVersion();
ServiceComponentHostRequest request = new ServiceComponentHostRequest(clusterName,
- serviceName, null, null, null, null);
+ serviceName, null, null, null);
Set<ServiceComponentHostResponse> hostComponentResponses =
controller.getHostComponents(Collections.singleton(request));
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/471403cd/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ComponentConfigMappingDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ComponentConfigMappingDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ComponentConfigMappingDAO.java
deleted file mode 100644
index ff22af9..0000000
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ComponentConfigMappingDAO.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * 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.orm.dao;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-import com.google.inject.Singleton;
-import com.google.inject.persist.Transactional;
-
-import javax.persistence.EntityManager;
-import javax.persistence.TypedQuery;
-
-import org.apache.ambari.server.orm.entities.ComponentConfigMappingEntity;
-
-@Singleton
-public class ComponentConfigMappingDAO {
-
- @Inject
- Provider<EntityManager> entityManagerProvider;
- @Inject
- DaoUtils daoUtils;
-
- @Transactional
- public List<ComponentConfigMappingEntity> findByType(
- Collection<String> configTypes) {
- TypedQuery<ComponentConfigMappingEntity> query =
- entityManagerProvider.get().createQuery(
- "SELECT config FROM ComponentConfigMappingEntity config"
- + " WHERE config.configType IN ?1",
- ComponentConfigMappingEntity.class);
- return daoUtils.selectList(query, configTypes);
- }
-
- @Transactional
- public List<ComponentConfigMappingEntity> findByComponentAndType(long clusterId, String serviceName, String componentName,
- Collection<String> configTypes) {
- if (configTypes.isEmpty()) {
- return Collections.emptyList();
- }
- TypedQuery<ComponentConfigMappingEntity> query = entityManagerProvider.get().createQuery("SELECT config " +
- "FROM ComponentConfigMappingEntity config " +
- "WHERE " +
- "config.clusterId = ?1 " +
- "AND config.serviceName = ?2 " +
- "AND config.componentName = ?3 " +
- "AND config.configType IN ?4",
- ComponentConfigMappingEntity.class);
- return daoUtils.selectList(query, clusterId, serviceName, componentName, configTypes);
- }
-
- @Transactional
- public void refresh(
- ComponentConfigMappingEntity componentConfigMappingEntity) {
- entityManagerProvider.get().refresh(componentConfigMappingEntity);
- }
-
- @Transactional
- public ComponentConfigMappingEntity merge(
- ComponentConfigMappingEntity componentConfigMappingEntity) {
- return entityManagerProvider.get().merge(
- componentConfigMappingEntity);
- }
-
- @Transactional
- public void remove(
- ComponentConfigMappingEntity componentConfigMappingEntity) {
- entityManagerProvider.get().remove(merge(componentConfigMappingEntity));
- }
-
- @Transactional
- public void removeByType(Collection<String> configTypes) {
- for (ComponentConfigMappingEntity entity : findByType(configTypes)) {
- remove(entity);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/471403cd/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentConfigMappingDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentConfigMappingDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentConfigMappingDAO.java
deleted file mode 100644
index 43848bf..0000000
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentConfigMappingDAO.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/**
- * 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.orm.dao;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-import com.google.inject.Singleton;
-import com.google.inject.persist.Transactional;
-
-import javax.persistence.EntityManager;
-import javax.persistence.TypedQuery;
-
-import org.apache.ambari.server.orm.entities.HostComponentConfigMappingEntity;
-
-@Singleton
-public class HostComponentConfigMappingDAO {
-
- @Inject
- Provider<EntityManager> entityManagerProvider;
- @Inject
- DaoUtils daoUtils;
-
- @Transactional
- public void create(HostComponentConfigMappingEntity entity) {
- entityManagerProvider.get().persist(entity);
- }
-
- @Transactional
- public List<HostComponentConfigMappingEntity> findByType(
- Collection<String> configTypes) {
- TypedQuery<HostComponentConfigMappingEntity> query =
- entityManagerProvider.get().createQuery(
- "SELECT config FROM HostComponentConfigMappingEntity config"
- + " WHERE config.configType IN ?1",
- HostComponentConfigMappingEntity.class);
- return daoUtils.selectList(query, configTypes);
- }
-
- @Transactional
- public void refresh(
- HostComponentConfigMappingEntity componentConfigMappingEntity) {
- entityManagerProvider.get().refresh(componentConfigMappingEntity);
- }
-
- @Transactional
- public HostComponentConfigMappingEntity merge(
- HostComponentConfigMappingEntity componentConfigMappingEntity) {
- return entityManagerProvider.get().merge(
- componentConfigMappingEntity);
- }
-
- @Transactional
- public void remove(
- HostComponentConfigMappingEntity componentConfigMappingEntity) {
- entityManagerProvider.get().remove(merge(componentConfigMappingEntity));
- }
-
- @Transactional
- public void removeByType(Collection<String> configTypes) {
- for (HostComponentConfigMappingEntity entity : findByType(configTypes)) {
- remove(entity);
- }
- }
-
- @Transactional
- public List<HostComponentConfigMappingEntity> findByHostComponentAndType(
- long clusterId, String serviceName, String componentName,
- String hostname,
- Collection<String> configTypes) {
- if (configTypes.isEmpty()) {
- return new ArrayList<HostComponentConfigMappingEntity>();
- }
- TypedQuery<HostComponentConfigMappingEntity> query =
- entityManagerProvider.get().createQuery(
- "SELECT config FROM HostComponentConfigMappingEntity config"
- + " WHERE "
- + " config.clusterId = ?1"
- + " AND config.serviceName = ?2"
- + " AND config.componentName = ?3"
- + " AND config.hostName = ?4"
- + " AND config.configType IN ?5",
- HostComponentConfigMappingEntity.class);
- return daoUtils.selectList(query, clusterId, serviceName,
- componentName, hostname, configTypes);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/471403cd/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentDesiredConfigMappingDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentDesiredConfigMappingDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentDesiredConfigMappingDAO.java
deleted file mode 100644
index c9f567f..0000000
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentDesiredConfigMappingDAO.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/**
- * 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.orm.dao;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-import com.google.inject.Singleton;
-import com.google.inject.persist.Transactional;
-
-import javax.persistence.EntityManager;
-import javax.persistence.TypedQuery;
-
-import org.apache.ambari.server.orm.entities.HostComponentDesiredConfigMappingEntity;
-
-@Singleton
-public class HostComponentDesiredConfigMappingDAO {
-
- @Inject
- Provider<EntityManager> entityManagerProvider;
- @Inject
- DaoUtils daoUtils;
-
- @Transactional
- public void create(HostComponentDesiredConfigMappingEntity entity) {
- entityManagerProvider.get().persist(entity);
- }
-
- @Transactional
- public List<HostComponentDesiredConfigMappingEntity> findByType(
- Collection<String> configTypes) {
- TypedQuery<HostComponentDesiredConfigMappingEntity> query =
- entityManagerProvider.get().createQuery(
- "SELECT config FROM HostComponentDesiredConfigMappingEntity config"
- + " WHERE config.configType IN ?1",
- HostComponentDesiredConfigMappingEntity.class);
- return daoUtils.selectList(query, configTypes);
- }
-
- @Transactional
- public List<HostComponentDesiredConfigMappingEntity> findByHostComponentAndType(
- long clusterId, String serviceName, String componentName,
- String hostname,
- Collection<String> configTypes) {
- if (configTypes.isEmpty()) {
- return new ArrayList<HostComponentDesiredConfigMappingEntity>();
- }
- TypedQuery<HostComponentDesiredConfigMappingEntity> query =
- entityManagerProvider.get().createQuery(
- "SELECT config FROM HostComponentDesiredConfigMappingEntity config"
- + " WHERE "
- + " config.clusterId = ?1"
- + " AND config.serviceName = ?2"
- + " AND config.componentName = ?3"
- + " AND config.hostName = ?4"
- + " AND config.configType IN ?5",
- HostComponentDesiredConfigMappingEntity.class);
- return daoUtils.selectList(query, clusterId, serviceName,
- componentName, hostname, configTypes);
- }
-
- @Transactional
- public void refresh(
- HostComponentDesiredConfigMappingEntity componentConfigMappingEntity) {
- entityManagerProvider.get().refresh(componentConfigMappingEntity);
- }
-
- @Transactional
- public HostComponentDesiredConfigMappingEntity merge(
- HostComponentDesiredConfigMappingEntity componentConfigMappingEntity) {
- return entityManagerProvider.get().merge(
- componentConfigMappingEntity);
- }
-
- @Transactional
- public void remove(
- HostComponentDesiredConfigMappingEntity componentConfigMappingEntity) {
- entityManagerProvider.get().remove(merge(componentConfigMappingEntity));
- }
-
- @Transactional
- public void removeByType(Collection<String> configTypes) {
- for (HostComponentDesiredConfigMappingEntity entity : findByType(configTypes)) {
- remove(entity);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/471403cd/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigMappingDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigMappingDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigMappingDAO.java
deleted file mode 100644
index f220595..0000000
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigMappingDAO.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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.orm.dao;
-
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-import com.google.inject.Singleton;
-import com.google.inject.persist.Transactional;
-import org.apache.ambari.server.orm.entities.ServiceConfigMappingEntity;
-
-import javax.persistence.EntityManager;
-import javax.persistence.TypedQuery;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-@Singleton
-public class ServiceConfigMappingDAO {
- @Inject
- Provider<EntityManager> entityManagerProvider;
- @Inject
- DaoUtils daoUtils;
-
- @Transactional
- public List<ServiceConfigMappingEntity> findByType(
- Collection<String> configTypes) {
- TypedQuery<ServiceConfigMappingEntity> query =
- entityManagerProvider.get().createQuery(
- "SELECT config FROM ServiceConfigMappingEntity config"
- + " WHERE config.configType IN ?1",
- ServiceConfigMappingEntity.class);
- return daoUtils.selectList(query, configTypes);
- }
-
- @Transactional
- public List<ServiceConfigMappingEntity> findByServiceAndType(
- long clusterId, String serviceName,
- Collection<String> configTypes) {
- if (configTypes.isEmpty()) {
- return Collections.emptyList();
- }
- TypedQuery<ServiceConfigMappingEntity> query =
- entityManagerProvider.get().createQuery(
- "SELECT config FROM ServiceConfigMappingEntity config"
- + " WHERE "
- + " config.clusterId = ?1"
- + " AND config.serviceName = ?2"
- + " AND config.configType IN ?3",
- ServiceConfigMappingEntity.class);
- return daoUtils.selectList(query, clusterId, serviceName, configTypes);
- }
-
- @Transactional
- public void refresh(
- ServiceConfigMappingEntity serviceConfigMappingEntity) {
- entityManagerProvider.get().refresh(serviceConfigMappingEntity);
- }
-
- @Transactional
- public ServiceConfigMappingEntity merge(
- ServiceConfigMappingEntity serviceConfigMappingEntity) {
- return entityManagerProvider.get().merge(
- serviceConfigMappingEntity);
- }
-
- @Transactional
- public void remove(
- ServiceConfigMappingEntity serviceConfigMappingEntity) {
- entityManagerProvider.get().remove(merge(serviceConfigMappingEntity));
- }
-
- @Transactional
- public void removeByType(Collection<String> configTypes) {
- for (ServiceConfigMappingEntity entity : findByType(configTypes)) {
- remove(entity);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/471403cd/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java
index 2d355bd..ce90856 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterConfigEntity.java
@@ -51,18 +51,6 @@ public class ClusterConfigEntity {
private ClusterEntity clusterEntity;
@OneToMany(mappedBy = "clusterConfigEntity")
- private Collection<HostComponentConfigMappingEntity> hostComponentConfigMappingEntities;
-
- @OneToMany(mappedBy = "clusterConfigEntity")
- private Collection<ServiceConfigMappingEntity> serviceConfigMappingEntities;
-
- @OneToMany(mappedBy = "clusterConfigEntity")
- private Collection<HostComponentDesiredConfigMappingEntity> hostComponentDesiredConfigMappingEntities;
-
- @OneToMany(mappedBy = "clusterConfigEntity")
- private Collection<ComponentConfigMappingEntity> componentConfigMappingEntities;
-
- @OneToMany(mappedBy = "clusterConfigEntity")
private Collection<ConfigGroupConfigMappingEntity> configGroupConfigMappingEntities;
public Long getClusterId() {
@@ -134,38 +122,6 @@ public class ClusterConfigEntity {
this.clusterEntity = clusterEntity;
}
- public Collection<HostComponentConfigMappingEntity> getHostComponentConfigMappingEntities() {
- return hostComponentConfigMappingEntities;
- }
-
- public void setHostComponentConfigMappingEntities(Collection<HostComponentConfigMappingEntity> hostComponentConfigMappingEntities) {
- this.hostComponentConfigMappingEntities = hostComponentConfigMappingEntities;
- }
-
- public Collection<ServiceConfigMappingEntity> getServiceConfigMappingEntities() {
- return serviceConfigMappingEntities;
- }
-
- public void setServiceConfigMappingEntities(Collection<ServiceConfigMappingEntity> serviceConfigMappingEntities) {
- this.serviceConfigMappingEntities = serviceConfigMappingEntities;
- }
-
- public Collection<HostComponentDesiredConfigMappingEntity> getHostComponentDesiredConfigMappingEntities() {
- return hostComponentDesiredConfigMappingEntities;
- }
-
- public void setHostComponentDesiredConfigMappingEntities(Collection<HostComponentDesiredConfigMappingEntity> hostComponentDesiredConfigMappingEntities) {
- this.hostComponentDesiredConfigMappingEntities = hostComponentDesiredConfigMappingEntities;
- }
-
- public Collection<ComponentConfigMappingEntity> getComponentConfigMappingEntities() {
- return componentConfigMappingEntities;
- }
-
- public void setComponentConfigMappingEntities(Collection<ComponentConfigMappingEntity> componentConfigMappingEntities) {
- this.componentConfigMappingEntities = componentConfigMappingEntities;
- }
-
public Collection<ConfigGroupConfigMappingEntity> getConfigGroupConfigMappingEntities() {
return configGroupConfigMappingEntities;
}
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/471403cd/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterServiceEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterServiceEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterServiceEntity.java
index 23df513..d34e2d5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterServiceEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterServiceEntity.java
@@ -55,9 +55,6 @@ public class ClusterServiceEntity {
@OneToMany(mappedBy = "clusterServiceEntity")
private Collection<ServiceComponentDesiredStateEntity> serviceComponentDesiredStateEntities;
- @OneToMany(mappedBy = "serviceEntity", cascade = CascadeType.ALL)
- private Collection<ServiceConfigMappingEntity> serviceConfigMappings;
-
public Long getClusterId() {
return clusterId;
}
@@ -129,14 +126,4 @@ public class ClusterServiceEntity {
this.serviceComponentDesiredStateEntities = serviceComponentDesiredStateEntities;
}
- public Collection<ServiceConfigMappingEntity> getServiceConfigMappings() {
- return serviceConfigMappings;
- }
-
- public void setServiceConfigMappings(Collection<ServiceConfigMappingEntity> entities) {
- serviceConfigMappings = entities;
- }
-
-
-
}
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/471403cd/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ComponentConfigMappingEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ComponentConfigMappingEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ComponentConfigMappingEntity.java
deleted file mode 100644
index 2001f90..0000000
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ComponentConfigMappingEntity.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/**
- * 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.orm.entities;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.IdClass;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinColumns;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-
-@IdClass(ComponentConfigMappingEntityPK.class)
-@Entity
-@Table(name = "componentconfigmapping")
-public class ComponentConfigMappingEntity {
-
- @Id
- @Column(name = "cluster_id", insertable = false, updatable = false, nullable = false)
- private Long clusterId;
-
- @Id
- @Column(name = "service_name", insertable = false, updatable = false, nullable = false)
- private String serviceName;
-
- @Id
- @Column(name = "component_name", insertable = false, updatable = false, nullable = false)
- private String componentName;
-
- @Id
- @Column(name = "config_type", insertable = true, updatable = false, nullable = false)
- private String configType;
-
- @Column(name = "config_tag", nullable = false, insertable = true, updatable = true)
- private String configTag;
-
- @Column(name="timestamp", nullable = false, insertable = true, updatable = true)
- private Long timestamp;
-
- @ManyToOne
- @JoinColumns({
- @JoinColumn(name = "cluster_id", referencedColumnName = "cluster_id", nullable = false),
- @JoinColumn(name = "service_name", referencedColumnName = "service_name", nullable = false),
- @JoinColumn(name = "component_name", referencedColumnName = "component_name", nullable = false)
- })
- private ServiceComponentDesiredStateEntity serviceComponentDesiredStateEntity;
-
- @ManyToOne
- @JoinColumns({
- @JoinColumn(name = "cluster_id", referencedColumnName = "cluster_id", nullable = false, insertable = false, updatable = false),
- @JoinColumn(name = "config_type", referencedColumnName = "type_name", nullable = false, insertable = false, updatable = false),
- @JoinColumn(name = "config_tag", referencedColumnName = "version_tag", nullable = false, insertable = false, updatable = false)
- })
- private ClusterConfigEntity clusterConfigEntity;
-
- public Long getClusterId() {
- return clusterId;
- }
-
- public void setClusterId(Long id) {
- clusterId = id;
- }
-
- public String getServiceName() {
- return serviceName;
- }
-
- public void setServiceName(String name) {
- serviceName = name;
- }
-
- public String getComponentName() {
- return componentName;
- }
-
- public void setComponentName(String name) {
- componentName = name;
- }
-
- public String getConfigType() {
- return configType;
- }
-
- public void setConfigType(String type) {
- configType = type;
- }
-
- public String getVersionTag() {
- return configTag;
- }
-
- public void setVersionTag(String tag) {
- configTag = tag;
- }
-
- public Long getTimestamp() {
- return timestamp;
- }
-
- public void setTimestamp(Long stamp) {
- timestamp = stamp;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- ComponentConfigMappingEntity that = (ComponentConfigMappingEntity) o;
-
- if (clusterId != null ? !clusterId.equals(that.clusterId) : that.clusterId != null) return false;
- if (serviceName != null ? !serviceName.equals(that.serviceName) : that.serviceName != null) return false;
- if (componentName != null ? !componentName.equals(that.componentName) : that.componentName != null) return false;
- if (configType != null ? !configType.equals(that.configType) : that.configType != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = clusterId !=null ? clusterId.intValue() : 0;
- result = 31 * result + (serviceName != null ? serviceName.hashCode() : 0);
- result = 31 * result + (componentName != null ? componentName.hashCode() : 0);
- result = 31 * result + (configType != null ? configType.hashCode() : 0);
- return result;
- }
-
-
- public ServiceComponentDesiredStateEntity getServiceComponentDesiredStateEntity() {
- return serviceComponentDesiredStateEntity;
- }
-
- public void setServiceComponentDesiredStateEntity(ServiceComponentDesiredStateEntity entity) {
- serviceComponentDesiredStateEntity = entity;
- }
-
- public ClusterConfigEntity getClusterConfigEntity() {
- return clusterConfigEntity;
- }
-
- public void setClusterConfigEntity(ClusterConfigEntity clusterConfigEntity) {
- this.clusterConfigEntity = clusterConfigEntity;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/471403cd/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ComponentConfigMappingEntityPK.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ComponentConfigMappingEntityPK.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ComponentConfigMappingEntityPK.java
deleted file mode 100644
index 9eeef26..0000000
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ComponentConfigMappingEntityPK.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/**
- * 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.orm.entities;
-
-import java.io.Serializable;
-
-import javax.persistence.Column;
-import javax.persistence.Id;
-
-/**
- * @author ncole
- *
- */
-@SuppressWarnings("serial")
-public class ComponentConfigMappingEntityPK implements Serializable {
- private Long clusterId;
- private String serviceName;
- private String componentName;
- private String configType;
-
- @Id
- @Column(name = "cluster_id", insertable = true, updatable = true, nullable = false, length = 10)
- public Long getClusterId() {
- return clusterId;
- }
-
- public void setClusterId(Long clusterId) {
- this.clusterId = clusterId;
- }
-
- @Id
- @Column(name = "service_name", insertable = true, updatable = true, nullable = false)
- public String getServiceName() {
- return serviceName;
- }
-
- public void setServiceName(String serviceName) {
- this.serviceName = serviceName;
- }
-
- @Column(name = "component_name", insertable = true, updatable = true, nullable = false)
- @Id
- public String getComponentName() {
- return componentName;
- }
-
- public void setComponentName(String name) {
- componentName = name;
- }
-
- @Column(name = "config_type", insertable = true, updatable = false, nullable = false)
- @Id
- public String getConfigType() {
- return configType;
- }
-
- public void setConfigType(String type) {
- configType = type;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- ComponentConfigMappingEntityPK that = (ComponentConfigMappingEntityPK) o;
-
- if (clusterId != null ? !clusterId.equals(that.clusterId) : that.clusterId != null) return false;
- if (componentName != null ? !componentName.equals(that.componentName) : that.componentName != null) return false;
- if (serviceName != null ? !serviceName.equals(that.serviceName) : that.serviceName != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = clusterId != null ? clusterId.intValue() : 0;
- result = 31 * result + (serviceName != null ? serviceName.hashCode() : 0);
- result = 31 * result + (componentName != null ? componentName.hashCode() : 0);
- return result;
- }
-
-
-
-
-
-}