You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ma...@apache.org on 2012/10/16 08:38:26 UTC
svn commit: r1398669 [2/5] - in /incubator/ambari/branches/AMBARI-666: ./
ambari-project/ ambari-server/
ambari-server/src/main/java/org/apache/ambari/server/actionmanager/
ambari-server/src/main/java/org/apache/ambari/server/agent/
ambari-server/src/m...
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterServiceEntity.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterServiceEntity.java?rev=1398669&r1=1398668&r2=1398669&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterServiceEntity.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterServiceEntity.java Tue Oct 16 06:38:23 2012
@@ -19,28 +19,34 @@
package org.apache.ambari.server.orm.entities;
import javax.persistence.*;
-import java.util.List;
+import java.util.Collection;
-@IdClass(ClusterServiceEntityPK.class)
-@Table(name = "clusterservices", schema = "ambari", catalog = "")
+@javax.persistence.IdClass(ClusterServiceEntityPK.class)
+@javax.persistence.Table(name = "clusterservices", schema = "ambari", catalog = "")
+@NamedQueries({
+ @NamedQuery(name = "clusterServiceByClusterAndServiceNames", query =
+ "SELECT clusterService " +
+ "FROM ClusterServiceEntity clusterService " +
+ "JOIN clusterService.clusterEntity cluster " +
+ "WHERE clusterService.serviceName=:serviceName AND cluster.clusterName=:clusterName")
+})
@Entity
public class ClusterServiceEntity {
+ private Long clusterId;
- private String clusterName;
-
- @Column(name = "cluster_name", nullable = false, insertable = false, updatable = false)
+ @javax.persistence.Column(name = "cluster_id", nullable = false, insertable = false, updatable = false, length = 10)
@Id
- public String getClusterName() {
- return clusterName;
+ public Long getClusterId() {
+ return clusterId;
}
- public void setClusterName(String clusterName) {
- this.clusterName = clusterName;
+ public void setClusterId(Long clusterId) {
+ this.clusterId = clusterId;
}
private String serviceName;
- @Column(name = "service_name")
+ @javax.persistence.Column(name = "service_name", nullable = false, insertable = true, updatable = true)
@Id
public String getServiceName() {
return serviceName;
@@ -52,20 +58,43 @@ public class ClusterServiceEntity {
private Integer serviceEnabled = 0;
- @Column(name = "service_enabled", nullable = false)
+ @javax.persistence.Column(name = "service_enabled", nullable = false, insertable = true, updatable = true, length = 10)
@Basic
- public Integer getServiceEnabled() {
+ public int getServiceEnabled() {
return serviceEnabled;
}
- public void setServiceEnabled(Integer serviceEnabled) {
+ public void setServiceEnabled(int serviceEnabled) {
this.serviceEnabled = serviceEnabled;
}
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ ClusterServiceEntity that = (ClusterServiceEntity) o;
+
+ if (clusterId != null ? !clusterId.equals(that.clusterId) : that.clusterId != null) return false;
+ if (serviceEnabled != null ? !serviceEnabled.equals(that.serviceEnabled) : that.serviceEnabled != 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 + serviceEnabled;
+ return result;
+ }
+
private ClusterEntity clusterEntity;
@ManyToOne
- @JoinColumn(name = "cluster_name")
+ @javax.persistence.JoinColumn(name = "cluster_id", referencedColumnName = "cluster_id", nullable = false)
public ClusterEntity getClusterEntity() {
return clusterEntity;
}
@@ -74,92 +103,69 @@ public class ClusterServiceEntity {
this.clusterEntity = clusterEntity;
}
- private List<ServiceConfigEntity> serviceConfigEntities;
+ private Collection<HostComponentMappingEntity> hostComponentMappingEntities;
@OneToMany(mappedBy = "clusterServiceEntity")
- public List<ServiceConfigEntity> getServiceConfigEntities() {
- return serviceConfigEntities;
+ public Collection<HostComponentMappingEntity> getHostComponentMappingEntities() {
+ return hostComponentMappingEntities;
}
- public void setServiceConfigEntities(List<ServiceConfigEntity> serviceConfigEntities) {
- this.serviceConfigEntities = serviceConfigEntities;
+ public void setHostComponentMappingEntities(Collection<HostComponentMappingEntity> hostComponentMappingEntities) {
+ this.hostComponentMappingEntities = hostComponentMappingEntities;
}
- private List<ServiceComponentConfigEntity> serviceComponentConfigEntities;
+ private Collection<ServiceComponentConfigEntity> serviceComponentConfigEntities;
@OneToMany(mappedBy = "clusterServiceEntity")
- public List<ServiceComponentConfigEntity> getServiceComponentConfigEntities() {
+ public Collection<ServiceComponentConfigEntity> getServiceComponentConfigEntities() {
return serviceComponentConfigEntities;
}
- public void setServiceComponentConfigEntities(List<ServiceComponentConfigEntity> serviceComponentConfigEntities) {
+ public void setServiceComponentConfigEntities(Collection<ServiceComponentConfigEntity> serviceComponentConfigEntities) {
this.serviceComponentConfigEntities = serviceComponentConfigEntities;
}
- private List<ServiceComponentHostConfigEntity> serviceComponentHostConfigEntities;
+ private Collection<ServiceComponentHostConfigEntity> serviceComponentHostConfigEntities;
@OneToMany(mappedBy = "clusterServiceEntity")
- public List<ServiceComponentHostConfigEntity> getServiceComponentHostConfigEntities() {
+ public Collection<ServiceComponentHostConfigEntity> getServiceComponentHostConfigEntities() {
return serviceComponentHostConfigEntities;
}
- public void setServiceComponentHostConfigEntities(List<ServiceComponentHostConfigEntity> serviceComponentHostConfigEntities) {
+ public void setServiceComponentHostConfigEntities(Collection<ServiceComponentHostConfigEntity> serviceComponentHostConfigEntities) {
this.serviceComponentHostConfigEntities = serviceComponentHostConfigEntities;
}
- private List<ServiceDesiredStateEntity> serviceDesiredStateEntities;
+ private Collection<ServiceConfigEntity> serviceConfigEntities;
@OneToMany(mappedBy = "clusterServiceEntity")
- public List<ServiceDesiredStateEntity> getServiceDesiredStateEntities() {
- return serviceDesiredStateEntities;
+ public Collection<ServiceConfigEntity> getServiceConfigEntities() {
+ return serviceConfigEntities;
}
- public void setServiceDesiredStateEntities(List<ServiceDesiredStateEntity> serviceDesiredStateEntities) {
- this.serviceDesiredStateEntities = serviceDesiredStateEntities;
+ public void setServiceConfigEntities(Collection<ServiceConfigEntity> serviceConfigEntities) {
+ this.serviceConfigEntities = serviceConfigEntities;
}
- private List<HostComponentMappingEntity> hostComponentMappingEntities;
+ private ServiceDesiredStateEntity serviceDesiredStateEntity;
- @OneToMany(mappedBy = "clusterServiceEntity")
- public List<HostComponentMappingEntity> getHostComponentMappingEntities() {
- return hostComponentMappingEntities;
+ @OneToOne(mappedBy = "clusterServiceEntity")
+ public ServiceDesiredStateEntity getServiceDesiredStateEntity() {
+ return serviceDesiredStateEntity;
}
- public void setHostComponentMappingEntities(List<HostComponentMappingEntity> hostComponentMappingEntities) {
- this.hostComponentMappingEntities = hostComponentMappingEntities;
+ public void setServiceDesiredStateEntity(ServiceDesiredStateEntity serviceDesiredStateEntity) {
+ this.serviceDesiredStateEntity = serviceDesiredStateEntity;
}
- private List<ServiceStateEntity> serviceStateEntities;
+ private Collection<ServiceComponentDesiredStateEntity> serviceComponentDesiredStateEntities;
@OneToMany(mappedBy = "clusterServiceEntity")
- public List<ServiceStateEntity> getServiceStateEntities() {
- return serviceStateEntities;
- }
-
- public void setServiceStateEntities(List<ServiceStateEntity> serviceStateEntities) {
- this.serviceStateEntities = serviceStateEntities;
+ public Collection<ServiceComponentDesiredStateEntity> getServiceComponentDesiredStateEntities() {
+ return serviceComponentDesiredStateEntities;
}
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- ClusterServiceEntity that = (ClusterServiceEntity) o;
-
- if (clusterName != null ? !clusterName.equals(that.clusterName) : that.clusterName != null) return false;
- if (serviceEnabled != null ? !serviceEnabled.equals(that.serviceEnabled) : that.serviceEnabled != null)
- return false;
- if (serviceName != null ? !serviceName.equals(that.serviceName) : that.serviceName != null) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = clusterName != null ? clusterName.hashCode() : 0;
- result = 31 * result + (serviceName != null ? serviceName.hashCode() : 0);
- result = 31 * result + (serviceEnabled != null ? serviceEnabled.hashCode() : 0);
- return result;
+ public void setServiceComponentDesiredStateEntities(Collection<ServiceComponentDesiredStateEntity> serviceComponentDesiredStateEntities) {
+ this.serviceComponentDesiredStateEntities = serviceComponentDesiredStateEntities;
}
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterServiceEntityPK.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterServiceEntityPK.java?rev=1398669&r1=1398668&r2=1398669&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterServiceEntityPK.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterServiceEntityPK.java Tue Oct 16 06:38:23 2012
@@ -23,23 +23,22 @@ import javax.persistence.Id;
import java.io.Serializable;
public class ClusterServiceEntityPK implements Serializable {
-
- private String clusterName;
+ private Long clusterId;
@Id
- @Column(name = "cluster_name")
- public String getClusterName() {
- return clusterName;
+ @Column(name = "cluster_id", nullable = false, insertable = true, updatable = true, length = 10)
+ public Long getClusterId() {
+ return clusterId;
}
- public void setClusterName(String clusterName) {
- this.clusterName = clusterName;
+ public void setClusterId(Long clusterId) {
+ this.clusterId = clusterId;
}
private String serviceName;
@Id
- @Column(name = "service_name")
+ @Column(name = "service_name", nullable = false, insertable = true, updatable = true)
public String getServiceName() {
return serviceName;
}
@@ -55,7 +54,7 @@ public class ClusterServiceEntityPK impl
ClusterServiceEntityPK that = (ClusterServiceEntityPK) o;
- if (clusterName != null ? !clusterName.equals(that.clusterName) : that.clusterName != null) return false;
+ if (clusterId != null ? !clusterId.equals(that.clusterId) : that.clusterId != null) return false;
if (serviceName != null ? !serviceName.equals(that.serviceName) : that.serviceName != null) return false;
return true;
@@ -63,7 +62,7 @@ public class ClusterServiceEntityPK impl
@Override
public int hashCode() {
- int result = clusterName != null ? clusterName.hashCode() : 0;
+ int result = clusterId !=null ? clusterId.intValue() : 0;
result = 31 * result + (serviceName != null ? serviceName.hashCode() : 0);
return result;
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterStateEntity.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterStateEntity.java?rev=1398669&r1=1398668&r2=1398669&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterStateEntity.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterStateEntity.java Tue Oct 16 06:38:23 2012
@@ -18,27 +18,29 @@
package org.apache.ambari.server.orm.entities;
-import javax.persistence.*;
+import javax.persistence.Basic;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.OneToOne;
@javax.persistence.Table(name = "clusterstate", schema = "ambari", catalog = "")
@Entity
public class ClusterStateEntity {
+ private Long clusterId;
- private String clusterName;
-
- @javax.persistence.Column(name = "cluster_name", insertable = false, updatable = false)
+ @javax.persistence.Column(name = "cluster_id", nullable = false, insertable = false, updatable = false, length = 10)
@Id
- public String getClusterName() {
- return clusterName;
+ public Long getClusterId() {
+ return clusterId;
}
- public void setClusterName(String clusterName) {
- this.clusterName = clusterName;
+ public void setClusterId(Long clusterId) {
+ this.clusterId = clusterId;
}
private String currentClusterState = "";
- @javax.persistence.Column(name = "current_cluster_state", nullable = false)
+ @javax.persistence.Column(name = "current_cluster_state", nullable = false, insertable = true, updatable = true)
@Basic
public String getCurrentClusterState() {
return currentClusterState;
@@ -48,18 +50,6 @@ public class ClusterStateEntity {
this.currentClusterState = currentClusterState;
}
- private ClusterEntity clusterEntity;
-
- @OneToOne
- @JoinColumn(name = "cluster_name")
- public ClusterEntity getClusterEntity() {
- return clusterEntity;
- }
-
- public void setClusterEntity(ClusterEntity clusterEntity) {
- this.clusterEntity = clusterEntity;
- }
-
@Override
public boolean equals(Object o) {
if (this == o) return true;
@@ -67,7 +57,7 @@ public class ClusterStateEntity {
ClusterStateEntity that = (ClusterStateEntity) o;
- if (clusterName != null ? !clusterName.equals(that.clusterName) : that.clusterName != null) return false;
+ if (clusterId != null ? !clusterId.equals(that.clusterId) : that.clusterId != null) return false;
if (currentClusterState != null ? !currentClusterState.equals(that.currentClusterState) : that.currentClusterState != null)
return false;
@@ -76,8 +66,20 @@ public class ClusterStateEntity {
@Override
public int hashCode() {
- int result = clusterName != null ? clusterName.hashCode() : 0;
+ int result = clusterId !=null ? clusterId.intValue() : 0;
result = 31 * result + (currentClusterState != null ? currentClusterState.hashCode() : 0);
return result;
}
+
+ private ClusterEntity clusterEntity;
+
+ @OneToOne
+ @javax.persistence.JoinColumn(name = "cluster_id", referencedColumnName = "cluster_id", nullable = false)
+ public ClusterEntity getClusterEntity() {
+ return clusterEntity;
+ }
+
+ public void setClusterEntity(ClusterEntity clusterEntity) {
+ this.clusterEntity = clusterEntity;
+ }
}
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java?rev=1398669&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntity.java Tue Oct 16 06:38:23 2012
@@ -0,0 +1,170 @@
+/**
+ * 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 org.apache.ambari.server.state.State;
+
+import javax.persistence.*;
+
+@javax.persistence.IdClass(HostComponentDesiredStateEntityPK.class)
+@javax.persistence.Table(name = "hostcomponentdesiredstate", schema = "ambari", catalog = "")
+@Entity
+public class HostComponentDesiredStateEntity {
+ private Long clusterId;
+
+ @javax.persistence.Column(name = "cluster_id", nullable = false, insertable = false, updatable = false, length = 10)
+ @Id
+ public Long getClusterId() {
+ return clusterId;
+ }
+
+ public void setClusterId(Long clusterId) {
+ this.clusterId = clusterId;
+ }
+
+ private String serviceName;
+
+ @javax.persistence.Column(name = "service_name", nullable = false, insertable = false, updatable = false)
+ @Id
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ private String hostName = "";
+
+ @javax.persistence.Column(name = "host_name", nullable = false, insertable = false, updatable = false)
+ @Id
+ public String getHostName() {
+ return hostName;
+ }
+
+ public void setHostName(String hostName) {
+ this.hostName = hostName;
+ }
+
+ private String componentName = "";
+
+ @javax.persistence.Column(name = "component_name", nullable = false, insertable = false, updatable = false)
+ @Id
+ public String getComponentName() {
+ return componentName;
+ }
+
+ public void setComponentName(String componentName) {
+ this.componentName = componentName;
+ }
+
+ private State desiredState = State.INIT;
+
+ @javax.persistence.Column(name = "desired_state", nullable = false, insertable = true, updatable = true)
+ @Basic
+ public State getDesiredState() {
+ return desiredState;
+ }
+
+ public void setDesiredState(State desiredState) {
+ this.desiredState = desiredState;
+ }
+
+ private String desiredConfigVersion = "";
+
+ @javax.persistence.Column(name = "desired_config_version", nullable = false, insertable = true, updatable = true)
+ @Basic
+ public String getDesiredConfigVersion() {
+ return desiredConfigVersion;
+ }
+
+ public void setDesiredConfigVersion(String desiredConfigVersion) {
+ this.desiredConfigVersion = desiredConfigVersion;
+ }
+
+ private String desiredStackVersion = "";
+
+ @javax.persistence.Column(name = "desired_stack_version", nullable = false, insertable = true, updatable = true)
+ @Basic
+ public String getDesiredStackVersion() {
+ return desiredStackVersion;
+ }
+
+ public void setDesiredStackVersion(String desiredStackVersion) {
+ this.desiredStackVersion = desiredStackVersion;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ HostComponentDesiredStateEntity that = (HostComponentDesiredStateEntity) 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 (desiredConfigVersion != null ? !desiredConfigVersion.equals(that.desiredConfigVersion) : that.desiredConfigVersion != null)
+ return false;
+ if (desiredStackVersion != null ? !desiredStackVersion.equals(that.desiredStackVersion) : that.desiredStackVersion != null)
+ return false;
+ if (desiredState != null ? !desiredState.equals(that.desiredState) : that.desiredState != null) return false;
+ if (hostName != null ? !hostName.equals(that.hostName) : that.hostName != 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 + (hostName != null ? hostName.hashCode() : 0);
+ result = 31 * result + (componentName != null ? componentName.hashCode() : 0);
+ result = 31 * result + (desiredState != null ? desiredState.hashCode() : 0);
+ result = 31 * result + (desiredConfigVersion != null ? desiredConfigVersion.hashCode() : 0);
+ result = 31 * result + (desiredStackVersion != null ? desiredStackVersion.hashCode() : 0);
+ result = 31 * result + (serviceName != null ? serviceName.hashCode() : 0);
+ return result;
+ }
+
+ private ServiceComponentDesiredStateEntity serviceComponentDesiredStateEntity;
+
+ @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)})
+ public ServiceComponentDesiredStateEntity getServiceComponentDesiredStateEntity() {
+ return serviceComponentDesiredStateEntity;
+ }
+
+ public void setServiceComponentDesiredStateEntity(ServiceComponentDesiredStateEntity serviceComponentDesiredStateEntity) {
+ this.serviceComponentDesiredStateEntity = serviceComponentDesiredStateEntity;
+ }
+
+ private HostEntity hostEntity;
+
+ @ManyToOne
+ @javax.persistence.JoinColumn(name = "host_name", referencedColumnName = "host_name", nullable = false)
+ public HostEntity getHostEntity() {
+ return hostEntity;
+ }
+
+ public void setHostEntity(HostEntity hostEntity) {
+ this.hostEntity = hostEntity;
+ }
+}
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntityPK.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntityPK.java?rev=1398669&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntityPK.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentDesiredStateEntityPK.java Tue Oct 16 06:38:23 2012
@@ -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.orm.entities;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+
+public class HostComponentDesiredStateEntityPK implements Serializable {
+ private Long clusterId;
+
+ @Id
+ @Column(name = "cluster_id", nullable = false, insertable = true, updatable = true, length = 10)
+ public Long getClusterId() {
+ return clusterId;
+ }
+
+ public void setClusterId(Long clusterId) {
+ this.clusterId = clusterId;
+ }
+
+ private String serviceName;
+
+ @Id
+ @Column(name = "service_name", nullable = false, insertable = true, updatable = true)
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ private String hostName;
+
+ @Id
+ @Column(name = "host_name", nullable = false, insertable = true, updatable = true)
+ public String getHostName() {
+ return hostName;
+ }
+
+ public void setHostName(String hostName) {
+ this.hostName = hostName;
+ }
+
+ private String componentName;
+
+ @Id
+ @Column(name = "component_name", nullable = false, insertable = true, updatable = true)
+ public String getComponentName() {
+ return componentName;
+ }
+
+ public void setComponentName(String componentName) {
+ this.componentName = componentName;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ HostComponentDesiredStateEntityPK that = (HostComponentDesiredStateEntityPK) 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 (hostName != null ? !hostName.equals(that.hostName) : that.hostName != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = clusterId !=null ? clusterId.intValue() : 0;
+ result = 31 * result + (hostName != null ? hostName.hashCode() : 0);
+ result = 31 * result + (componentName != null ? componentName.hashCode() : 0);
+ return result;
+ }
+}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentMappingEntity.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentMappingEntity.java?rev=1398669&r1=1398668&r2=1398669&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentMappingEntity.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentMappingEntity.java Tue Oct 16 06:38:23 2012
@@ -20,26 +20,25 @@ package org.apache.ambari.server.orm.ent
import javax.persistence.*;
-@IdClass(HostComponentMappingEntityPK.class)
-@Table(name = "hostcomponentmapping", schema = "ambari", catalog = "")
+@javax.persistence.IdClass(HostComponentMappingEntityPK.class)
+@javax.persistence.Table(name = "hostcomponentmapping", schema = "ambari", catalog = "")
@Entity
public class HostComponentMappingEntity {
+ private Long clusterId;
- private String clusterName = "";
-
- @Column(name = "cluster_name", insertable = false, updatable = false)
+ @javax.persistence.Column(name = "cluster_id", nullable = false, insertable = false, updatable = false, length = 10)
@Id
- public String getClusterName() {
- return clusterName;
+ public Long getClusterId() {
+ return clusterId;
}
- public void setClusterName(String clusterName) {
- this.clusterName = clusterName;
+ public void setClusterId(Long clusterId) {
+ this.clusterId = clusterId;
}
private String serviceName = "";
- @Column(name = "service_name", nullable = false, insertable = false, updatable = false)
+ @javax.persistence.Column(name = "service_name", nullable = false, insertable = false, updatable = false)
@Id
public String getServiceName() {
return serviceName;
@@ -51,7 +50,7 @@ public class HostComponentMappingEntity
private Integer hostComponentMappingId;
- @Column(name = "host_component_mapping_id")
+ @javax.persistence.Column(name = "host_component_mapping_id", nullable = false, insertable = true, updatable = true, length = 10)
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Integer getHostComponentMappingId() {
@@ -64,7 +63,7 @@ public class HostComponentMappingEntity
private String hostComponentMappingSnapshot;
- @Column(name = "host_component_mapping_snapshot")
+ @javax.persistence.Column(name = "host_component_mapping_snapshot", nullable = false, insertable = true, updatable = true)
@Basic
public String getHostComponentMappingSnapshot() {
return hostComponentMappingSnapshot;
@@ -74,18 +73,6 @@ public class HostComponentMappingEntity
this.hostComponentMappingSnapshot = hostComponentMappingSnapshot;
}
- ClusterServiceEntity clusterServiceEntity;
-
- @ManyToOne
- @JoinColumns(value = {@JoinColumn(name = "cluster_name", referencedColumnName = "cluster_name"), @JoinColumn(name = "service_name", referencedColumnName = "service_name")})
- public ClusterServiceEntity getClusterServiceEntity() {
- return clusterServiceEntity;
- }
-
- public void setClusterServiceEntity(ClusterServiceEntity clusterServiceEntity) {
- this.clusterServiceEntity = clusterServiceEntity;
- }
-
@Override
public boolean equals(Object o) {
if (this == o) return true;
@@ -93,9 +80,8 @@ public class HostComponentMappingEntity
HostComponentMappingEntity that = (HostComponentMappingEntity) o;
- if (clusterName != null ? !clusterName.equals(that.clusterName) : that.clusterName != null) return false;
- if (hostComponentMappingId != null ? !hostComponentMappingId.equals(that.hostComponentMappingId) : that.hostComponentMappingId != null)
- return false;
+ if (clusterId != null ? !clusterId.equals(that.clusterId) : that.clusterId != null) return false;
+ if (hostComponentMappingId != null ? !hostComponentMappingId.equals(that.hostComponentMappingId) : that.hostComponentMappingId != null) return false;
if (hostComponentMappingSnapshot != null ? !hostComponentMappingSnapshot.equals(that.hostComponentMappingSnapshot) : that.hostComponentMappingSnapshot != null)
return false;
if (serviceName != null ? !serviceName.equals(that.serviceName) : that.serviceName != null) return false;
@@ -105,10 +91,22 @@ public class HostComponentMappingEntity
@Override
public int hashCode() {
- int result = clusterName != null ? clusterName.hashCode() : 0;
+ int result = clusterId !=null ? clusterId.intValue() : 0;
result = 31 * result + (serviceName != null ? serviceName.hashCode() : 0);
result = 31 * result + (hostComponentMappingId != null ? hostComponentMappingId.hashCode() : 0);
result = 31 * result + (hostComponentMappingSnapshot != null ? hostComponentMappingSnapshot.hashCode() : 0);
return result;
}
+
+ private ClusterServiceEntity clusterServiceEntity;
+
+ @ManyToOne
+ @javax.persistence.JoinColumns({@javax.persistence.JoinColumn(name = "cluster_id", referencedColumnName = "cluster_id", nullable = false), @javax.persistence.JoinColumn(name = "service_name", referencedColumnName = "service_name", nullable = false)})
+ public ClusterServiceEntity getClusterServiceEntity() {
+ return clusterServiceEntity;
+ }
+
+ public void setClusterServiceEntity(ClusterServiceEntity clusterServiceEntity) {
+ this.clusterServiceEntity = clusterServiceEntity;
+ }
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentMappingEntityPK.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentMappingEntityPK.java?rev=1398669&r1=1398668&r2=1398669&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentMappingEntityPK.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentMappingEntityPK.java Tue Oct 16 06:38:23 2012
@@ -23,23 +23,22 @@ import javax.persistence.Id;
import java.io.Serializable;
public class HostComponentMappingEntityPK implements Serializable {
+ private Long clusterId;
- private String clusterName;
-
+ @javax.persistence.Column(name = "cluster_id", nullable = false, insertable = false, updatable = false, length = 10)
@Id
- @Column(name = "cluster_name")
- public String getClusterName() {
- return clusterName;
+ public Long getClusterId() {
+ return clusterId;
}
- public void setClusterName(String clusterName) {
- this.clusterName = clusterName;
+ public void setClusterId(Long clusterId) {
+ this.clusterId = clusterId;
}
private String serviceName;
@Id
- @Column(name = "service_name")
+ @Column(name = "service_name", nullable = false, insertable = true, updatable = true)
public String getServiceName() {
return serviceName;
}
@@ -51,7 +50,7 @@ public class HostComponentMappingEntityP
private Integer hostComponentMappingId;
@Id
- @Column(name = "host_component_mapping_id")
+ @Column(name = "host_component_mapping_id", nullable = false, insertable = true, updatable = true, length = 10)
public Integer getHostComponentMappingId() {
return hostComponentMappingId;
}
@@ -67,9 +66,8 @@ public class HostComponentMappingEntityP
HostComponentMappingEntityPK that = (HostComponentMappingEntityPK) o;
- if (clusterName != null ? !clusterName.equals(that.clusterName) : that.clusterName != null) return false;
- if (hostComponentMappingId != null ? !hostComponentMappingId.equals(that.hostComponentMappingId) : that.hostComponentMappingId != null)
- return false;
+ if (clusterId != null ? !clusterId.equals(that.clusterId) : that.clusterId != null) return false;
+ if (hostComponentMappingId != null ? !hostComponentMappingId.equals(that.hostComponentMappingId) : that.hostComponentMappingId != null) return false;
if (serviceName != null ? !serviceName.equals(that.serviceName) : that.serviceName != null) return false;
return true;
@@ -77,9 +75,9 @@ public class HostComponentMappingEntityP
@Override
public int hashCode() {
- int result = clusterName != null ? clusterName.hashCode() : 0;
+ int result = clusterId !=null ? clusterId.intValue() : 0;
result = 31 * result + (serviceName != null ? serviceName.hashCode() : 0);
- result = 31 * result + (hostComponentMappingId != null ? hostComponentMappingId.hashCode() : 0);
+ result = 31 * result + hostComponentMappingId;
return result;
}
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntity.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntity.java?rev=1398669&r1=1398668&r2=1398669&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntity.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntity.java Tue Oct 16 06:38:23 2012
@@ -18,28 +18,41 @@
package org.apache.ambari.server.orm.entities;
+import org.apache.ambari.server.state.State;
+
import javax.persistence.*;
@javax.persistence.IdClass(HostComponentStateEntityPK.class)
@javax.persistence.Table(name = "hostcomponentstate", schema = "ambari", catalog = "")
@Entity
public class HostComponentStateEntity {
+ private Long clusterId;
+
+ @javax.persistence.Column(name = "cluster_id", nullable = false, insertable = false, updatable = false, length = 10)
+ @Id
+ public Long getClusterId() {
+ return clusterId;
+ }
+
+ public void setClusterId(Long clusterId) {
+ this.clusterId = clusterId;
+ }
- private String clusterName;
+ private String serviceName;
- @javax.persistence.Column(name = "cluster_name", insertable = false, updatable = false)
+ @javax.persistence.Column(name = "service_name", nullable = false, insertable = false, updatable = false)
@Id
- public String getClusterName() {
- return clusterName;
+ public String getServiceName() {
+ return serviceName;
}
- public void setClusterName(String clusterName) {
- this.clusterName = clusterName;
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
}
- private String hostName;
+ private String hostName = "";
- @javax.persistence.Column(name = "host_name", insertable = false, updatable = false)
+ @javax.persistence.Column(name = "host_name", nullable = false, insertable = false, updatable = false)
@Id
public String getHostName() {
return hostName;
@@ -51,7 +64,7 @@ public class HostComponentStateEntity {
private String componentName;
- @javax.persistence.Column(name = "component_name")
+ @javax.persistence.Column(name = "component_name", nullable = false, insertable = false, updatable = false)
@Id
public String getComponentName() {
return componentName;
@@ -61,21 +74,21 @@ public class HostComponentStateEntity {
this.componentName = componentName;
}
- private String currentState;
+ private State currentState = State.INIT;
- @javax.persistence.Column(name = "current_state")
- @Basic
- public String getCurrentState() {
+ @javax.persistence.Column(name = "current_state", nullable = false, insertable = true, updatable = true)
+ @Enumerated(value = EnumType.STRING)
+ public State getCurrentState() {
return currentState;
}
- public void setCurrentState(String currentState) {
+ public void setCurrentState(State currentState) {
this.currentState = currentState;
}
- private String currentConfigVersion;
+ private String currentConfigVersion = "";
- @javax.persistence.Column(name = "current_config_version")
+ @javax.persistence.Column(name = "current_config_version", nullable = false, insertable = true, updatable = true)
@Basic
public String getCurrentConfigVersion() {
return currentConfigVersion;
@@ -87,7 +100,7 @@ public class HostComponentStateEntity {
private String currentStackVersion;
- @javax.persistence.Column(name = "current_stack_version")
+ @javax.persistence.Column(name = "current_stack_version", nullable = false, insertable = true, updatable = true)
@Basic
public String getCurrentStackVersion() {
return currentStackVersion;
@@ -97,30 +110,6 @@ public class HostComponentStateEntity {
this.currentStackVersion = currentStackVersion;
}
- private ClusterEntity clusterEntity;
-
- @ManyToOne
- @JoinColumn(name = "cluster_name")
- public ClusterEntity getClusterEntity() {
- return clusterEntity;
- }
-
- public void setClusterEntity(ClusterEntity clusterEntity) {
- this.clusterEntity = clusterEntity;
- }
-
- private HostEntity hostEntity;
-
- @ManyToOne
- @JoinColumn(name = "host_name")
- public HostEntity getHostEntity() {
- return hostEntity;
- }
-
- public void setHostEntity(HostEntity hostEntity) {
- this.hostEntity = hostEntity;
- }
-
@Override
public boolean equals(Object o) {
if (this == o) return true;
@@ -128,7 +117,7 @@ public class HostComponentStateEntity {
HostComponentStateEntity that = (HostComponentStateEntity) o;
- if (clusterName != null ? !clusterName.equals(that.clusterName) : that.clusterName != null) return false;
+ 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 (currentConfigVersion != null ? !currentConfigVersion.equals(that.currentConfigVersion) : that.currentConfigVersion != null)
return false;
@@ -136,18 +125,47 @@ public class HostComponentStateEntity {
return false;
if (currentState != null ? !currentState.equals(that.currentState) : that.currentState != null) return false;
if (hostName != null ? !hostName.equals(that.hostName) : that.hostName != null) return false;
+ if (serviceName != null ? !serviceName.equals(that.serviceName) : that.serviceName != null) return false;
return true;
}
@Override
public int hashCode() {
- int result = clusterName != null ? clusterName.hashCode() : 0;
+ int result = clusterId != null ? clusterId.intValue() : 0;
result = 31 * result + (hostName != null ? hostName.hashCode() : 0);
result = 31 * result + (componentName != null ? componentName.hashCode() : 0);
result = 31 * result + (currentState != null ? currentState.hashCode() : 0);
result = 31 * result + (currentConfigVersion != null ? currentConfigVersion.hashCode() : 0);
result = 31 * result + (currentStackVersion != null ? currentStackVersion.hashCode() : 0);
+ result = 31 * result + (serviceName != null ? serviceName.hashCode() : 0);
return result;
}
+
+ private ServiceComponentDesiredStateEntity serviceComponentDesiredStateEntity;
+
+ @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)})
+ public ServiceComponentDesiredStateEntity getServiceComponentDesiredStateEntity() {
+ return serviceComponentDesiredStateEntity;
+ }
+
+ public void setServiceComponentDesiredStateEntity(ServiceComponentDesiredStateEntity serviceComponentDesiredStateEntity) {
+ this.serviceComponentDesiredStateEntity = serviceComponentDesiredStateEntity;
+ }
+
+ private HostEntity hostEntity;
+
+ @ManyToOne
+ @JoinColumn(name = "host_name", referencedColumnName = "host_name", nullable = false)
+ public HostEntity getHostEntity() {
+ return hostEntity;
+ }
+
+ public void setHostEntity(HostEntity hostEntity) {
+ this.hostEntity = hostEntity;
+ }
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntityPK.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntityPK.java?rev=1398669&r1=1398668&r2=1398669&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntityPK.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntityPK.java Tue Oct 16 06:38:23 2012
@@ -23,23 +23,34 @@ import javax.persistence.Id;
import java.io.Serializable;
public class HostComponentStateEntityPK implements Serializable {
+ private Long clusterId;
- private String clusterName;
+ @Id
+ @Column(name = "cluster_id", nullable = false, insertable = true, updatable = true, length = 10)
+ public Long getClusterId() {
+ return clusterId;
+ }
+
+ public void setClusterId(Long clusterId) {
+ this.clusterId = clusterId;
+ }
+
+ private String serviceName;
@Id
- @Column(name = "cluster_name")
- public String getClusterName() {
- return clusterName;
+ @Column(name = "service_name", nullable = false, insertable = true, updatable = true)
+ public String getServiceName() {
+ return serviceName;
}
- public void setClusterName(String clusterName) {
- this.clusterName = clusterName;
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
}
private String hostName;
@Id
- @Column(name = "host_name")
+ @Column(name = "host_name", nullable = false, insertable = true, updatable = true)
public String getHostName() {
return hostName;
}
@@ -51,7 +62,7 @@ public class HostComponentStateEntityPK
private String componentName;
@Id
- @Column(name = "component_name")
+ @Column(name = "component_name", nullable = false, insertable = true, updatable = true)
public String getComponentName() {
return componentName;
}
@@ -67,7 +78,7 @@ public class HostComponentStateEntityPK
HostComponentStateEntityPK that = (HostComponentStateEntityPK) o;
- if (clusterName != null ? !clusterName.equals(that.clusterName) : that.clusterName != null) return false;
+ 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 (hostName != null ? !hostName.equals(that.hostName) : that.hostName != null) return false;
@@ -76,7 +87,7 @@ public class HostComponentStateEntityPK
@Override
public int hashCode() {
- int result = clusterName != null ? clusterName.hashCode() : 0;
+ int result = clusterId !=null ? clusterId.intValue() : 0;
result = 31 * result + (hostName != null ? hostName.hashCode() : 0);
result = 31 * result + (componentName != null ? componentName.hashCode() : 0);
return result;
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostEntity.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostEntity.java?rev=1398669&r1=1398668&r2=1398669&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostEntity.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostEntity.java Tue Oct 16 06:38:23 2012
@@ -19,27 +19,14 @@
package org.apache.ambari.server.orm.entities;
import javax.persistence.*;
-import java.util.List;
+import java.util.Collection;
-@Table(name = "hosts", schema = "ambari", catalog = "")
+@javax.persistence.Table(name = "hosts", schema = "ambari", catalog = "")
@Entity
public class HostEntity {
-
- private String clusterName;
-
- @Column(name = "cluster_name", insertable = false, updatable = false)
- @Basic
- public String getClusterName() {
- return clusterName;
- }
-
- public void setClusterName(String clusterName) {
- this.clusterName = clusterName;
- }
-
private String hostName;
- @Column(name = "host_name", nullable = false)
+ @javax.persistence.Column(name = "host_name", nullable = false, insertable = true, updatable = true)
@Id
public String getHostName() {
return hostName;
@@ -49,33 +36,45 @@ public class HostEntity {
this.hostName = hostName;
}
- private String ip;
+ private String ipv4;
+
+ @javax.persistence.Column(name = "ipv4", nullable = true, insertable = true, updatable = true)
+ @Basic
+ public String getIpv4() {
+ return ipv4;
+ }
+
+ public void setIpv4(String ipv4) {
+ this.ipv4 = ipv4;
+ }
+
+ private String ipv6;
- @Column(name = "ip", unique = true, nullable = false)
+ @javax.persistence.Column(name = "ipv6", nullable = true, insertable = true, updatable = true)
@Basic
- public String getIp() {
- return ip;
+ public String getIpv6() {
+ return ipv6;
}
- public void setIp(String ip) {
- this.ip = ip;
+ public void setIpv6(String ipv6) {
+ this.ipv6 = ipv6;
}
- private Integer totalMem = 0;
+ private Long totalMem = 0L;
- @Column(name = "total_mem", nullable = false)
+ @javax.persistence.Column(name = "total_mem", nullable = false, insertable = true, updatable = true, length = 10)
@Basic
- public Integer getTotalMem() {
+ public Long getTotalMem() {
return totalMem;
}
- public void setTotalMem(Integer totalMem) {
+ public void setTotalMem(Long totalMem) {
this.totalMem = totalMem;
}
private Integer cpuCount = 0;
- @Column(name = "cpu_count", nullable = false)
+ @javax.persistence.Column(name = "cpu_count", nullable = false, insertable = true, updatable = true, length = 10)
@Basic
public Integer getCpuCount() {
return cpuCount;
@@ -87,7 +86,7 @@ public class HostEntity {
private String cpuInfo = "";
- @Column(name = "cpu_info", nullable = false)
+ @javax.persistence.Column(name = "cpu_info", nullable = false, insertable = true, updatable = true)
@Basic
public String getCpuInfo() {
return cpuInfo;
@@ -99,7 +98,7 @@ public class HostEntity {
private String osArch = "";
- @Column(name = "os_arch", nullable = false)
+ @javax.persistence.Column(name = "os_arch", nullable = false, insertable = true, updatable = true)
@Basic
public String getOsArch() {
return osArch;
@@ -111,7 +110,7 @@ public class HostEntity {
private String disksInfo = "";
- @Column(name = "disks_info", nullable = false)
+ @javax.persistence.Column(name = "disks_info", nullable = false, insertable = true, updatable = true)
@Basic
public String getDisksInfo() {
return disksInfo;
@@ -123,7 +122,7 @@ public class HostEntity {
private String osInfo = "";
- @Column(name = "os_info", nullable = false)
+ @javax.persistence.Column(name = "os_info", nullable = false, insertable = true, updatable = true)
@Basic
public String getOsInfo() {
return osInfo;
@@ -135,7 +134,7 @@ public class HostEntity {
private String osType = "";
- @Column(name = "os_type", nullable = false)
+ @javax.persistence.Column(name = "os_type", nullable = false, insertable = true, updatable = true)
@Basic
public String getOsType() {
return osType;
@@ -147,7 +146,7 @@ public class HostEntity {
private String discoveryStatus = "";
- @Column(name = "discovery_status", nullable = false)
+ @javax.persistence.Column(name = "discovery_status", nullable = false, insertable = true, updatable = true)
@Basic
public String getDiscoveryStatus() {
return discoveryStatus;
@@ -157,21 +156,21 @@ public class HostEntity {
this.discoveryStatus = discoveryStatus;
}
- private Integer lastRegistrationTime = 0;
+ private Long lastRegistrationTime = 0L;
- @Column(name = "last_registration_time", nullable = false)
+ @javax.persistence.Column(name = "last_registration_time", nullable = false, insertable = true, updatable = true, length = 10)
@Basic
- public Integer getLastRegistrationTime() {
+ public Long getLastRegistrationTime() {
return lastRegistrationTime;
}
- public void setLastRegistrationTime(Integer lastRegistrationTime) {
+ public void setLastRegistrationTime(Long lastRegistrationTime) {
this.lastRegistrationTime = lastRegistrationTime;
}
private String rackInfo = "/default-rack";
- @Column(name = "rack_info", nullable = false)
+ @javax.persistence.Column(name = "rack_info", nullable = false, insertable = true, updatable = true)
@Basic
public String getRackInfo() {
return rackInfo;
@@ -183,7 +182,7 @@ public class HostEntity {
private String hostAttributes = "";
- @Column(name = "host_attributes", nullable = false)
+ @javax.persistence.Column(name = "host_attributes", nullable = false, insertable = true, updatable = true)
@Basic
public String getHostAttributes() {
return hostAttributes;
@@ -193,139 +192,141 @@ public class HostEntity {
this.hostAttributes = hostAttributes;
}
- private ClusterEntity clusterEntity;
-
- @ManyToOne
- @JoinColumn(name = "cluster_name")
- public ClusterEntity getClusterEntity() {
- return clusterEntity;
- }
-
- public void setClusterEntity(ClusterEntity clusterEntity) {
- this.clusterEntity = clusterEntity;
- }
-
- private HostStateEntity hostStateEntity;
-
- @OneToOne(cascade = CascadeType.ALL, mappedBy = "hostEntity")
- public HostStateEntity getHostStateEntity() {
- return hostStateEntity;
- }
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
- public void setHostStateEntity(HostStateEntity hostStateEntity) {
- this.hostStateEntity = hostStateEntity;
- }
+ HostEntity that = (HostEntity) o;
- private List<ActionStatusEntity> actionStatusEntity;
+ if (cpuCount != that.cpuCount) return false;
+ if (lastRegistrationTime != that.lastRegistrationTime) return false;
+ if (totalMem != that.totalMem) return false;
+ if (cpuInfo != null ? !cpuInfo.equals(that.cpuInfo) : that.cpuInfo != null) return false;
+ if (discoveryStatus != null ? !discoveryStatus.equals(that.discoveryStatus) : that.discoveryStatus != null)
+ return false;
+ if (disksInfo != null ? !disksInfo.equals(that.disksInfo) : that.disksInfo != null) return false;
+ if (hostAttributes != null ? !hostAttributes.equals(that.hostAttributes) : that.hostAttributes != null)
+ return false;
+ if (hostName != null ? !hostName.equals(that.hostName) : that.hostName != null) return false;
+ if (ipv4 != null ? !ipv4.equals(that.ipv4) : that.ipv4 != null) return false;
+ if (osArch != null ? !osArch.equals(that.osArch) : that.osArch != null) return false;
+ if (osInfo != null ? !osInfo.equals(that.osInfo) : that.osInfo != null) return false;
+ if (osType != null ? !osType.equals(that.osType) : that.osType != null) return false;
+ if (rackInfo != null ? !rackInfo.equals(that.rackInfo) : that.rackInfo != null) return false;
- @OneToMany(mappedBy = "hostEntity")
- public List<ActionStatusEntity> getActionStatusEntity() {
- return actionStatusEntity;
+ return true;
}
- public void setActionStatusEntity(List<ActionStatusEntity> actionStatusEntity) {
- this.actionStatusEntity = actionStatusEntity;
+ @Override
+ public int hashCode() {
+ int result = hostName != null ? hostName.hashCode() : 0;
+ result = 31 * result + (ipv4 != null ? ipv4.hashCode() : 0);
+ result = 31 * result + (totalMem != null ? totalMem.intValue() : 0);
+ result = 31 * result + cpuCount;
+ result = 31 * result + (cpuInfo != null ? cpuInfo.hashCode() : 0);
+ result = 31 * result + (osArch != null ? osArch.hashCode() : 0);
+ result = 31 * result + (disksInfo != null ? disksInfo.hashCode() : 0);
+ result = 31 * result + (osInfo != null ? osInfo.hashCode() : 0);
+ result = 31 * result + (osType != null ? osType.hashCode() : 0);
+ result = 31 * result + (discoveryStatus != null ? discoveryStatus.hashCode() : 0);
+ result = 31 * result + (lastRegistrationTime != null ? lastRegistrationTime.intValue() : 0);
+ result = 31 * result + (rackInfo != null ? rackInfo.hashCode() : 0);
+ result = 31 * result + (hostAttributes != null ? hostAttributes.hashCode() : 0);
+ return result;
}
- private List<ServiceComponentHostConfigEntity> serviceComponentHostConfigEntities;
+ private Collection<ActionStatusEntity> actionStatusEntities;
@OneToMany(mappedBy = "hostEntity")
- public List<ServiceComponentHostConfigEntity> getServiceComponentHostConfigEntities() {
- return serviceComponentHostConfigEntities;
+ public Collection<ActionStatusEntity> getActionStatusEntities() {
+ return actionStatusEntities;
}
- public void setServiceComponentHostConfigEntities(List<ServiceComponentHostConfigEntity> serviceComponentHostConfigEntities) {
- this.serviceComponentHostConfigEntities = serviceComponentHostConfigEntities;
+ public void setActionStatusEntities(Collection<ActionStatusEntity> actionStatusEntities) {
+ this.actionStatusEntities = actionStatusEntities;
}
- private List<ComponentHostDesiredStateEntity> componentHostDesiredStateEntities;
+ private Collection<HostComponentDesiredStateEntity> hostComponentDesiredStateEntities;
@OneToMany(mappedBy = "hostEntity")
- public List<ComponentHostDesiredStateEntity> getComponentHostDesiredStateEntities() {
- return componentHostDesiredStateEntities;
+ public Collection<HostComponentDesiredStateEntity> getHostComponentDesiredStateEntities() {
+ return hostComponentDesiredStateEntities;
}
- public void setComponentHostDesiredStateEntities(List<ComponentHostDesiredStateEntity> componentHostDesiredStateEntities) {
- this.componentHostDesiredStateEntities = componentHostDesiredStateEntities;
+ public void setHostComponentDesiredStateEntities(Collection<HostComponentDesiredStateEntity> hostComponentDesiredStateEntities) {
+ this.hostComponentDesiredStateEntities = hostComponentDesiredStateEntities;
}
- private List<HostComponentStateEntity> hostComponentStateEntities;
+ private Collection<HostComponentStateEntity> hostComponentStateEntities;
@OneToMany(mappedBy = "hostEntity")
- public List<HostComponentStateEntity> getHostComponentStateEntities() {
+ public Collection<HostComponentStateEntity> getHostComponentStateEntities() {
return hostComponentStateEntities;
}
- public void setHostComponentStateEntities(List<HostComponentStateEntity> hostComponentStateEntities) {
+ public void setHostComponentStateEntities(Collection<HostComponentStateEntity> hostComponentStateEntities) {
this.hostComponentStateEntities = hostComponentStateEntities;
}
- private List<ServiceStateEntity> serviceStateEntities;
+ private Collection<ClusterEntity> clusterEntities;
- @OneToMany(mappedBy = "hostEntity")
- public List<ServiceStateEntity> getServiceStateEntities() {
- return serviceStateEntities;
+ @ManyToMany
+// @JoinColumn(name = "cluster_id", referencedColumnName = "cluster_id")
+ @JoinTable(name = "ClusterHostMapping", catalog = "", schema = "ambari",
+ joinColumns = {@JoinColumn(name = "host_name", referencedColumnName = "host_name")},
+ inverseJoinColumns = {@JoinColumn(name = "cluster_id", referencedColumnName = "cluster_id")}
+
+ )
+ public Collection<ClusterEntity> getClusterEntities() {
+ return clusterEntities;
}
- public void setServiceStateEntities(List<ServiceStateEntity> serviceStateEntities) {
- this.serviceStateEntities = serviceStateEntities;
+ public void setClusterEntities(Collection<ClusterEntity> clusterEntities) {
+ this.clusterEntities = clusterEntities;
}
- private List<ServiceComponentStateEntity> serviceComponentStateEntities;
+ private HostStateEntity hostStateEntity;
- @OneToMany(mappedBy = "hostEntity")
- public List<ServiceComponentStateEntity> getServiceComponentStateEntities() {
- return serviceComponentStateEntities;
+ @OneToOne(mappedBy = "hostEntity")
+ public HostStateEntity getHostStateEntity() {
+ return hostStateEntity;
}
- public void setServiceComponentStateEntities(List<ServiceComponentStateEntity> serviceComponentStateEntities) {
- this.serviceComponentStateEntities = serviceComponentStateEntities;
+ public void setHostStateEntity(HostStateEntity hostStateEntity) {
+ this.hostStateEntity = hostStateEntity;
}
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- HostEntity that = (HostEntity) o;
-
- if (clusterName != null ? !clusterName.equals(that.clusterName) : that.clusterName != null) return false;
- if (cpuCount != null ? !cpuCount.equals(that.cpuCount) : that.cpuCount != null) return false;
- if (cpuInfo != null ? !cpuInfo.equals(that.cpuInfo) : that.cpuInfo != null) return false;
- if (discoveryStatus != null ? !discoveryStatus.equals(that.discoveryStatus) : that.discoveryStatus != null)
- return false;
- if (disksInfo != null ? !disksInfo.equals(that.disksInfo) : that.disksInfo != null) return false;
- if (hostAttributes != null ? !hostAttributes.equals(that.hostAttributes) : that.hostAttributes != null)
- return false;
- if (hostName != null ? !hostName.equals(that.hostName) : that.hostName != null) return false;
- if (ip != null ? !ip.equals(that.ip) : that.ip != null) return false;
- if (lastRegistrationTime != null ? !lastRegistrationTime.equals(that.lastRegistrationTime) : that.lastRegistrationTime != null)
- return false;
- if (osArch != null ? !osArch.equals(that.osArch) : that.osArch != null) return false;
- if (osInfo != null ? !osInfo.equals(that.osInfo) : that.osInfo != null) return false;
- if (osType != null ? !osType.equals(that.osType) : that.osType != null) return false;
- if (rackInfo != null ? !rackInfo.equals(that.rackInfo) : that.rackInfo != null) return false;
- if (totalMem != null ? !totalMem.equals(that.totalMem) : that.totalMem != null) return false;
+ private Collection<ServiceComponentHostConfigEntity> serviceComponentHostConfigEntities;
- return true;
+ @OneToMany(mappedBy = "hostEntity")
+ public Collection<ServiceComponentHostConfigEntity> getServiceComponentHostConfigEntities() {
+ return serviceComponentHostConfigEntities;
}
- @Override
- public int hashCode() {
- int result = clusterName != null ? clusterName.hashCode() : 0;
- result = 31 * result + (hostName != null ? hostName.hashCode() : 0);
- result = 31 * result + (ip != null ? ip.hashCode() : 0);
- result = 31 * result + (totalMem != null ? totalMem.hashCode() : 0);
- result = 31 * result + (cpuCount != null ? cpuCount.hashCode() : 0);
- result = 31 * result + (cpuInfo != null ? cpuInfo.hashCode() : 0);
- result = 31 * result + (osArch != null ? osArch.hashCode() : 0);
- result = 31 * result + (disksInfo != null ? disksInfo.hashCode() : 0);
- result = 31 * result + (osInfo != null ? osInfo.hashCode() : 0);
- result = 31 * result + (osType != null ? osType.hashCode() : 0);
- result = 31 * result + (discoveryStatus != null ? discoveryStatus.hashCode() : 0);
- result = 31 * result + (lastRegistrationTime != null ? lastRegistrationTime.hashCode() : 0);
- result = 31 * result + (rackInfo != null ? rackInfo.hashCode() : 0);
- result = 31 * result + (hostAttributes != null ? hostAttributes.hashCode() : 0);
- return result;
+ public void setServiceComponentHostConfigEntities(Collection<ServiceComponentHostConfigEntity> serviceComponentHostConfigEntities) {
+ this.serviceComponentHostConfigEntities = serviceComponentHostConfigEntities;
}
+
+// private Collection<ServiceComponentStateEntity> serviceComponentStateEntities;
+//
+// @OneToMany(mappedBy = "hostEntity")
+// public Collection<ServiceComponentStateEntity> getServiceComponentStateEntities() {
+// return serviceComponentStateEntities;
+// }
+//
+// public void setServiceComponentStateEntities(Collection<ServiceComponentStateEntity> serviceComponentStateEntities) {
+// this.serviceComponentStateEntities = serviceComponentStateEntities;
+// }
+
+// private Collection<ServiceStateEntity> serviceStateEntities;
+//
+// @OneToMany(mappedBy = "hostEntity")
+// public Collection<ServiceStateEntity> getServiceStateEntities() {
+// return serviceStateEntities;
+// }
+//
+// public void setServiceStateEntities(Collection<ServiceStateEntity> serviceStateEntities) {
+// this.serviceStateEntities = serviceStateEntities;
+// }
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostStateEntity.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostStateEntity.java?rev=1398669&r1=1398668&r2=1398669&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostStateEntity.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostStateEntity.java Tue Oct 16 06:38:23 2012
@@ -18,27 +18,16 @@
package org.apache.ambari.server.orm.entities;
+import org.apache.ambari.server.state.HostState;
+
import javax.persistence.*;
-@Table(name = "hoststate", schema = "ambari", catalog = "")
+@javax.persistence.Table(name = "hoststate", schema = "ambari", catalog = "")
@Entity
public class HostStateEntity {
-
- private String clusterName;
-
- @Column(name = "cluster_name", insertable = false, updatable = false)
- @Basic
- public String getClusterName() {
- return clusterName;
- }
-
- public void setClusterName(String clusterName) {
- this.clusterName = clusterName;
- }
-
private String hostName;
- @Column(name = "host_name", insertable = false, updatable = false)
+ @javax.persistence.Column(name = "host_name", nullable = false, insertable = false, updatable = false)
@Id
public String getHostName() {
return hostName;
@@ -48,64 +37,64 @@ public class HostStateEntity {
this.hostName = hostName;
}
- private Integer lastHeartbeatTime = 0;
+ private Long availableMem = 0L;
- @Column(name = "last_heartbeat_time")
+ @Column(name = "available_mem", nullable = false, insertable = true, updatable = true)
@Basic
- public Integer getLastHeartbeatTime() {
- return lastHeartbeatTime;
+ public Long getAvailableMem() {
+ return availableMem;
}
- public void setLastHeartbeatTime(Integer lastHeartbeatTime) {
- this.lastHeartbeatTime = lastHeartbeatTime;
+ public void setAvailableMem(Long availableMem) {
+ this.availableMem = availableMem;
}
- private String agentVersion = "";
+ private Long lastHeartbeatTime = 0L;
- @Column(name = "agent_version")
+ @javax.persistence.Column(name = "last_heartbeat_time", nullable = false, insertable = true, updatable = true, length = 10)
@Basic
- public String getAgentVersion() {
- return agentVersion;
+ public Long getLastHeartbeatTime() {
+ return lastHeartbeatTime;
}
- public void setAgentVersion(String agentVersion) {
- this.agentVersion = agentVersion;
+ public void setLastHeartbeatTime(Long lastHeartbeatTime) {
+ this.lastHeartbeatTime = lastHeartbeatTime;
}
- private String currentState;
+ private String healthStatus;
- @Column(name = "current_state")
+ @Column(name = "health_status", insertable = true, updatable = true)
@Basic
- public String getCurrentState() {
- return currentState;
+ public String getHealthStatus() {
+ return healthStatus;
}
- public void setCurrentState(String currentState) {
- this.currentState = currentState;
+ public void setHealthStatus(String healthStatus) {
+ this.healthStatus = healthStatus;
}
- private HostEntity hostEntity;
+ private String agentVersion = "";
- @OneToOne
- @JoinColumn(name = "host_name")
- public HostEntity getHostEntity() {
- return hostEntity;
+ @javax.persistence.Column(name = "agent_version", nullable = false, insertable = true, updatable = true)
+ @Basic
+ public String getAgentVersion() {
+ return agentVersion;
}
- public void setHostEntity(HostEntity hostEntity) {
- this.hostEntity = hostEntity;
+ public void setAgentVersion(String agentVersion) {
+ this.agentVersion = agentVersion;
}
- private ClusterEntity clusterEntity;
+ private HostState currentState = HostState.INIT;
- @ManyToOne
- @JoinColumn(name = "cluster_name")
- public ClusterEntity getClusterEntity() {
- return clusterEntity;
+ @javax.persistence.Column(name = "current_state", nullable = false, insertable = true, updatable = true)
+ @Enumerated(value = EnumType.STRING)
+ public HostState getCurrentState() {
+ return currentState;
}
- public void setClusterEntity(ClusterEntity clusterEntity) {
- this.clusterEntity = clusterEntity;
+ public void setCurrentState(HostState currentState) {
+ this.currentState = currentState;
}
@Override
@@ -115,23 +104,46 @@ public class HostStateEntity {
HostStateEntity that = (HostStateEntity) o;
+ if (availableMem != null ? !availableMem.equals(that.availableMem) : that.availableMem != null) return false;
+ if (lastHeartbeatTime != null ? !lastHeartbeatTime.equals(that.lastHeartbeatTime) : that.lastHeartbeatTime != null) return false;
if (agentVersion != null ? !agentVersion.equals(that.agentVersion) : that.agentVersion != null) return false;
- if (clusterName != null ? !clusterName.equals(that.clusterName) : that.clusterName != null) return false;
if (currentState != null ? !currentState.equals(that.currentState) : that.currentState != null) return false;
if (hostName != null ? !hostName.equals(that.hostName) : that.hostName != null) return false;
- if (lastHeartbeatTime != null ? !lastHeartbeatTime.equals(that.lastHeartbeatTime) : that.lastHeartbeatTime != null)
- return false;
return true;
}
@Override
public int hashCode() {
- int result = clusterName != null ? clusterName.hashCode() : 0;
- result = 31 * result + (hostName != null ? hostName.hashCode() : 0);
- result = 31 * result + (lastHeartbeatTime != null ? lastHeartbeatTime.hashCode() : 0);
+ int result = hostName != null ? hostName.hashCode() : 0;
+ result = 31 * result + (availableMem != null ? availableMem.intValue() : 0);
+ result = 31 * result + (lastHeartbeatTime != null ? lastHeartbeatTime.intValue() : 0);
result = 31 * result + (agentVersion != null ? agentVersion.hashCode() : 0);
result = 31 * result + (currentState != null ? currentState.hashCode() : 0);
return result;
}
+
+// private ClusterEntity clusterEntity;
+//
+// @ManyToOne
+// @javax.persistence.JoinColumn(name = "cluster_id", referencedColumnName = "cluster_id")
+// public ClusterEntity getClusterEntity() {
+// return clusterEntity;
+// }
+//
+// public void setClusterEntity(ClusterEntity clusterEntity) {
+// this.clusterEntity = clusterEntity;
+// }
+
+ private HostEntity hostEntity;
+
+ @OneToOne
+ @JoinColumn(name = "host_name", referencedColumnName = "host_name", nullable = false)
+ public HostEntity getHostEntity() {
+ return hostEntity;
+ }
+
+ public void setHostEntity(HostEntity hostEntity) {
+ this.hostEntity = hostEntity;
+ }
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RoleEntity.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RoleEntity.java?rev=1398669&r1=1398668&r2=1398669&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RoleEntity.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/RoleEntity.java Tue Oct 16 06:38:23 2012
@@ -56,14 +56,14 @@ public class RoleEntity {
return roleName != null ? roleName.hashCode() : 0;
}
- private Set<UserEntity> userEntities;
+ private Set<org.apache.ambari.server.orm.entities.UserEntity> userEntities;
@ManyToMany(mappedBy = "roleEntities")
- public Set<UserEntity> getUserEntities() {
+ public Set<org.apache.ambari.server.orm.entities.UserEntity> getUserEntities() {
return userEntities;
}
- public void setUserEntities(Set<UserEntity> userEntities) {
+ public void setUserEntities(Set<org.apache.ambari.server.orm.entities.UserEntity> userEntities) {
this.userEntities = userEntities;
}
}
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentConfigEntity.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentConfigEntity.java?rev=1398669&r1=1398668&r2=1398669&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentConfigEntity.java (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentConfigEntity.java Tue Oct 16 06:38:23 2012
@@ -21,13 +21,12 @@ package org.apache.ambari.server.orm.ent
import javax.persistence.*;
import java.util.Date;
-@Table(name = "servicecomponentconfig", schema = "ambari", catalog = "")
+@javax.persistence.Table(name = "servicecomponentconfig", schema = "ambari", catalog = "")
@Entity
public class ServiceComponentConfigEntity {
-
private Integer configVersion;
- @Column(name = "config_version")
+ @javax.persistence.Column(name = "config_version", nullable = false, insertable = true, updatable = true, length = 10)
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Integer getConfigVersion() {
@@ -38,33 +37,9 @@ public class ServiceComponentConfigEntit
this.configVersion = configVersion;
}
- private String clusterName;
-
- @Column(name = "cluster_name", nullable = false, insertable = false, updatable = false)
- @Basic
- public String getClusterName() {
- return clusterName;
- }
-
- public void setClusterName(String clusterName) {
- this.clusterName = clusterName;
- }
-
- private String serviceName;
-
- @Column(name = "service_name", nullable = false, insertable = false, updatable = false)
- @Basic
- public String getServiceName() {
- return serviceName;
- }
-
- public void setServiceName(String serviceName) {
- this.serviceName = serviceName;
- }
-
private String componentName;
- @Column(name = "component_name", nullable = false)
+ @javax.persistence.Column(name = "component_name", nullable = false, insertable = true, updatable = true)
@Basic
public String getComponentName() {
return componentName;
@@ -76,7 +51,7 @@ public class ServiceComponentConfigEntit
private String configSnapshot= "";
- @Column(name = "config_snapshot", nullable = false)
+ @javax.persistence.Column(name = "config_snapshot", nullable = false, insertable = true, updatable = true)
@Basic
public String getConfigSnapshot() {
return configSnapshot;
@@ -88,7 +63,7 @@ public class ServiceComponentConfigEntit
private Date configSnapshotTime;
- @Column(name = "config_snapshot_time", nullable = false)
+ @javax.persistence.Column(name = "config_snapshot_time", nullable = false, insertable = true, updatable = true, length = 29, precision = 6)
@Temporal(TemporalType.TIMESTAMP)
public Date getConfigSnapshotTime() {
return configSnapshotTime;
@@ -98,18 +73,6 @@ public class ServiceComponentConfigEntit
this.configSnapshotTime = configSnapshotTime;
}
- ClusterServiceEntity clusterServiceEntity;
-
- @ManyToOne
- @JoinColumns(value = {@JoinColumn(name = "cluster_name", referencedColumnName = "cluster_name"), @JoinColumn(name = "service_name", referencedColumnName = "service_name")})
- public ClusterServiceEntity getClusterServiceEntity() {
- return clusterServiceEntity;
- }
-
- public void setClusterServiceEntity(ClusterServiceEntity clusterServiceEntity) {
- this.clusterServiceEntity = clusterServiceEntity;
- }
-
@Override
public boolean equals(Object o) {
if (this == o) return true;
@@ -117,12 +80,12 @@ public class ServiceComponentConfigEntit
ServiceComponentConfigEntity that = (ServiceComponentConfigEntity) o;
- if (clusterName != null ? !clusterName.equals(that.clusterName) : that.clusterName != null) return false;
+ if (configVersion != null ? !configVersion.equals(that.configVersion) : that.configVersion != null) return false;
if (componentName != null ? !componentName.equals(that.componentName) : that.componentName != null) return false;
if (configSnapshot != null ? !configSnapshot.equals(that.configSnapshot) : that.configSnapshot != null)
return false;
- if (configVersion != null ? !configVersion.equals(that.configVersion) : that.configVersion != null) return false;
- if (serviceName != null ? !serviceName.equals(that.serviceName) : that.serviceName != null) return false;
+ if (configSnapshotTime != null ? !configSnapshotTime.equals(that.configSnapshotTime) : that.configSnapshotTime != null)
+ return false;
return true;
}
@@ -130,10 +93,21 @@ public class ServiceComponentConfigEntit
@Override
public int hashCode() {
int result = configVersion != null ? configVersion.hashCode() : 0;
- result = 31 * result + (clusterName != null ? clusterName.hashCode() : 0);
- result = 31 * result + (serviceName != null ? serviceName.hashCode() : 0);
result = 31 * result + (componentName != null ? componentName.hashCode() : 0);
result = 31 * result + (configSnapshot != null ? configSnapshot.hashCode() : 0);
+ result = 31 * result + (configSnapshotTime != null ? configSnapshotTime.hashCode() : 0);
return result;
}
+
+ private ClusterServiceEntity clusterServiceEntity;
+
+ @ManyToOne
+ @javax.persistence.JoinColumns({@javax.persistence.JoinColumn(name = "cluster_id", referencedColumnName = "cluster_id", nullable = false), @javax.persistence.JoinColumn(name = "service_name", referencedColumnName = "service_name", nullable = false)})
+ public ClusterServiceEntity getClusterServiceEntity() {
+ return clusterServiceEntity;
+ }
+
+ public void setClusterServiceEntity(ClusterServiceEntity clusterServiceEntity) {
+ this.clusterServiceEntity = clusterServiceEntity;
+ }
}
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntity.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntity.java?rev=1398669&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntity.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntity.java Tue Oct 16 06:38:23 2012
@@ -0,0 +1,150 @@
+/**
+ * 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 org.apache.ambari.server.state.State;
+
+import javax.persistence.*;
+import java.util.Collection;
+
+@javax.persistence.IdClass(ServiceComponentDesiredStateEntityPK.class)
+@javax.persistence.Table(name = "servicecomponentdesiredstate", schema = "ambari", catalog = "")
+@Entity
+public class ServiceComponentDesiredStateEntity {
+ private Long clusterId;
+
+ @javax.persistence.Column(name = "cluster_id", nullable = false, insertable = false, updatable = false, length = 10)
+ @Id
+ public Long getClusterId() {
+ return clusterId;
+ }
+
+ public void setClusterId(Long clusterId) {
+ this.clusterId = clusterId;
+ }
+
+ private String serviceName;
+
+ @javax.persistence.Column(name = "service_name", nullable = false, insertable = false, updatable = false)
+ @Id
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ private String componentName;
+
+ @javax.persistence.Column(name = "component_name", nullable = false, insertable = true, updatable = true)
+ @Id
+ public String getComponentName() {
+ return componentName;
+ }
+
+ public void setComponentName(String componentName) {
+ this.componentName = componentName;
+ }
+
+ private State desiredState = State.INIT;
+
+ @javax.persistence.Column(name = "desired_state", nullable = false, insertable = true, updatable = true)
+ @Enumerated(EnumType.STRING)
+ public State getDesiredState() {
+ return desiredState;
+ }
+
+ public void setDesiredState(State desiredState) {
+ this.desiredState = desiredState;
+ }
+
+ private String desiredStackVersion = "";
+
+ @javax.persistence.Column(name = "desired_stack_version", nullable = false, insertable = true, updatable = true)
+ @Basic
+ public String getDesiredStackVersion() {
+ return desiredStackVersion;
+ }
+
+ public void setDesiredStackVersion(String desiredStackVersion) {
+ this.desiredStackVersion = desiredStackVersion;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ ServiceComponentDesiredStateEntity that = (ServiceComponentDesiredStateEntity) 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 (desiredState != null ? !desiredState.equals(that.desiredState) : that.desiredState != null) return false;
+ if (serviceName != null ? !serviceName.equals(that.serviceName) : that.serviceName != null) return false;
+ if (desiredStackVersion != null ? !desiredStackVersion.equals(that.desiredStackVersion) : that.desiredStackVersion != 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 + (desiredState != null ? desiredState.hashCode() : 0);
+ result = 31 * result + (desiredStackVersion != null ? desiredStackVersion.hashCode() : 0);
+
+ return result;
+ }
+
+ private ClusterServiceEntity clusterServiceEntity;
+
+ @ManyToOne
+ @javax.persistence.JoinColumns({@javax.persistence.JoinColumn(name = "cluster_id", referencedColumnName = "cluster_id", nullable = false), @javax.persistence.JoinColumn(name = "service_name", referencedColumnName = "service_name", nullable = false)})
+ public ClusterServiceEntity getClusterServiceEntity() {
+ return clusterServiceEntity;
+ }
+
+ public void setClusterServiceEntity(ClusterServiceEntity clusterServiceEntity) {
+ this.clusterServiceEntity = clusterServiceEntity;
+ }
+
+ private Collection<HostComponentStateEntity> hostComponentStateEntities;
+
+ @OneToMany(mappedBy = "serviceComponentDesiredStateEntity")
+ public Collection<HostComponentStateEntity> getHostComponentStateEntities() {
+ return hostComponentStateEntities;
+ }
+
+ public void setHostComponentStateEntities(Collection<HostComponentStateEntity> hostComponentStateEntities) {
+ this.hostComponentStateEntities = hostComponentStateEntities;
+ }
+
+ private Collection<HostComponentDesiredStateEntity> hostComponentDesiredStateEntities;
+
+ @OneToMany(mappedBy = "serviceComponentDesiredStateEntity")
+ public Collection<HostComponentDesiredStateEntity> getHostComponentDesiredStateEntities() {
+ return hostComponentDesiredStateEntities;
+ }
+
+ public void setHostComponentDesiredStateEntities(Collection<HostComponentDesiredStateEntity> hostComponentDesiredStateEntities) {
+ this.hostComponentDesiredStateEntities = hostComponentDesiredStateEntities;
+ }
+}
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntityPK.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntityPK.java?rev=1398669&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntityPK.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentDesiredStateEntityPK.java Tue Oct 16 06:38:23 2012
@@ -0,0 +1,83 @@
+/**
+ * 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.Id;
+import java.io.Serializable;
+
+public class ServiceComponentDesiredStateEntityPK implements Serializable {
+ private Long clusterId;
+
+ @Column(name = "cluster_id", nullable = false, insertable = true, updatable = true, length = 10)
+ @Id
+ public Long getClusterId() {
+ return clusterId;
+ }
+
+ public void setClusterId(Long clusterId) {
+ this.clusterId = clusterId;
+ }
+
+ private String serviceName;
+
+ @javax.persistence.Column(name = "service_name", nullable = false, insertable = false, updatable = false)
+ @Id
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ private String componentName;
+
+ @Id
+ @Column(name = "component_name", nullable = false, insertable = true, updatable = true)
+ public String getComponentName() {
+ return componentName;
+ }
+
+ public void setComponentName(String componentName) {
+ this.componentName = componentName;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ ServiceComponentDesiredStateEntityPK that = (ServiceComponentDesiredStateEntityPK) 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;
+ }
+}