You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by hi...@apache.org on 2012/09/13 00:22:12 UTC
svn commit: r1384149 [1/3] - in /incubator/ambari/branches/AMBARI-666: ./
ambari-project/ ambari-server/
ambari-server/src/main/java/org/apache/ambari/server/orm/
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/
ambari-server/src/main/java...
Author: hitesh
Date: Wed Sep 12 22:22:10 2012
New Revision: 1384149
URL: http://svn.apache.org/viewvc?rev=1384149&view=rev
Log:
AMBARI-726. ORM-based data access layer for new design (Contributed by Jaimin Jetly)
Added:
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/GuiceJpaInitializer.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ActionStatusDAO.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterDAO.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterServiceDAO.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterStateDAO.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ComponentHostDesiredStateDAO.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentMappingDAO.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentStateDAO.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostDAO.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostStateDAO.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentConfigDAO.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentHostConfigDAO.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentStateDAO.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceDesiredStateDAO.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceStateDAO.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ActionStatusEntity.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ActionStatusEntityPK.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterEntity.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterServiceEntity.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterServiceEntityPK.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterStateEntity.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ComponentHostDesiredStateEntity.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ComponentHostDesiredStateEntityPK.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentMappingEntity.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentMappingEntityPK.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntity.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostComponentStateEntityPK.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostEntity.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostStateEntity.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentConfigEntity.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentHostConfigEntity.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentStateEntity.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceComponentStateEntityPK.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceConfigEntity.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceDesiredStateEntity.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceDesiredStateEntityPK.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceStateEntity.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ServiceStateEntityPK.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/resources/
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/resources/META-INF/
incubator/ambari/branches/AMBARI-666/ambari-server/src/main/resources/META-INF/persistence.xml (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/orm/
incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/orm/OrmTestHelper.java (with props)
incubator/ambari/branches/AMBARI-666/ambari-server/src/test/java/org/apache/ambari/server/orm/TestOrmImpl.java (with props)
Modified:
incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
incubator/ambari/branches/AMBARI-666/ambari-project/pom.xml
incubator/ambari/branches/AMBARI-666/ambari-server/pom.xml
Modified: incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt?rev=1384149&r1=1384148&r2=1384149&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt (original)
+++ incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt Wed Sep 12 22:22:10 2012
@@ -12,6 +12,8 @@ AMBARI-666 branch (unreleased changes)
NEW FEATURES
+ AMBARI-726. ORM-based data access layer for new design (Jaimin Jetly via hitesh)
+
AMBARI-728. Initial work on ServiceComponentNode FSM. (hitesh)
AMBARI-724. Add tabs, dynamic form generation, validation errors, and info
Modified: incubator/ambari/branches/AMBARI-666/ambari-project/pom.xml
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-project/pom.xml?rev=1384149&r1=1384148&r2=1384149&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-project/pom.xml (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-project/pom.xml Wed Sep 12 22:22:10 2012
@@ -38,6 +38,12 @@
<url>http://download.java.net/maven/glassfish/</url>
</pluginRepository>
</pluginRepositories>
+ <repositories>
+ <repository>
+ <id>EclipseLink</id>
+ <url>http://download.eclipse.org/rt/eclipselink/maven.repo</url>
+ </repository>
+ </repositories>
<profiles>
<profile>
<id>dist</id>
@@ -89,6 +95,26 @@
<version>3.0</version>
</dependency>
<dependency>
+ <groupId>com.google.inject.extensions</groupId>
+ <artifactId>guice-persist</artifactId>
+ <version>3.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ <version>10.9.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.persistence</groupId>
+ <artifactId>eclipselink</artifactId>
+ <version>2.4.0</version>
+ </dependency>
+ <dependency>
+ <groupId>postgresql</groupId>
+ <artifactId>postgresql</artifactId>
+ <version>9.1-901.jdbc4</version>
+ </dependency>
+ <dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.8.5</version>
Modified: incubator/ambari/branches/AMBARI-666/ambari-server/pom.xml
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/pom.xml?rev=1384149&r1=1384148&r2=1384149&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/pom.xml (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/pom.xml Wed Sep 12 22:22:10 2012
@@ -65,6 +65,22 @@
<artifactId>guice-assistedinject</artifactId>
</dependency>
<dependency>
+ <groupId>com.google.inject.extensions</groupId>
+ <artifactId>guice-persist</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derby</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.persistence</groupId>
+ <artifactId>eclipselink</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>postgresql</groupId>
+ <artifactId>postgresql</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/GuiceJpaInitializer.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/GuiceJpaInitializer.java?rev=1384149&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/GuiceJpaInitializer.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/GuiceJpaInitializer.java Wed Sep 12 22:22:10 2012
@@ -0,0 +1,34 @@
+/**
+ * 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;
+
+import com.google.inject.Inject;
+import com.google.inject.persist.PersistService;
+
+/**
+ * This class needs to be instantiated with guice to initialize Guice-persist
+ */
+public class GuiceJpaInitializer {
+
+ @Inject
+ public GuiceJpaInitializer(PersistService service) {
+ service.start();
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/GuiceJpaInitializer.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ActionStatusDAO.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ActionStatusDAO.java?rev=1384149&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ActionStatusDAO.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ActionStatusDAO.java Wed Sep 12 22:22:10 2012
@@ -0,0 +1,56 @@
+/**
+ * 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.persist.Transactional;
+import org.apache.ambari.server.orm.entities.ActionStatusEntity;
+import org.apache.ambari.server.orm.entities.ActionStatusEntityPK;
+
+import javax.persistence.EntityManager;
+
+public class ActionStatusDAO {
+ @Inject
+ EntityManager entityManager;
+
+ public ActionStatusEntity findByPK(ActionStatusEntityPK actionStatusEntityPK) {
+ return entityManager.find(ActionStatusEntity.class, actionStatusEntityPK);
+ }
+
+ @Transactional
+ public void create(ActionStatusEntity actionStatusEntity) {
+ entityManager.persist(actionStatusEntity);
+ }
+
+ @Transactional
+ public ActionStatusEntity merge(ActionStatusEntity actionStatusEntity) {
+ return entityManager.merge(actionStatusEntity);
+ }
+
+ @Transactional
+ public void remove(ActionStatusEntity actionStatusEntity) {
+ entityManager.remove(actionStatusEntity);
+ }
+
+ @Transactional
+ public void removeByPK(ActionStatusEntityPK actionStatusEntityPK) {
+ remove(findByPK(actionStatusEntityPK));
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ActionStatusDAO.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterDAO.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterDAO.java?rev=1384149&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterDAO.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterDAO.java Wed Sep 12 22:22:10 2012
@@ -0,0 +1,58 @@
+/**
+ * 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.persist.Transactional;
+import org.apache.ambari.server.orm.entities.ClusterEntity;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.persistence.EntityManager;
+
+public class ClusterDAO {
+ private static final Log log = LogFactory.getLog(ClusterDAO.class);
+
+ @Inject
+ EntityManager entityManager;
+
+ public ClusterEntity findByName(String clusterName) {
+ return entityManager.find(ClusterEntity.class, clusterName);
+ }
+
+ public void create(ClusterEntity clusterEntity) {
+ entityManager.persist(clusterEntity);
+ }
+
+ @Transactional
+ public ClusterEntity merge(ClusterEntity clusterEntity) {
+ return entityManager.merge(clusterEntity);
+ }
+
+ @Transactional
+ public void remove(ClusterEntity clusterEntity) {
+ entityManager.remove(clusterEntity);
+ }
+
+ @Transactional
+ public void removeByName(String clusterName) {
+ remove(findByName(clusterName));
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterDAO.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterServiceDAO.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterServiceDAO.java?rev=1384149&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterServiceDAO.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterServiceDAO.java Wed Sep 12 22:22:10 2012
@@ -0,0 +1,63 @@
+/**
+ * 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.persist.Transactional;
+import org.apache.ambari.server.orm.entities.ClusterServiceEntity;
+import org.apache.ambari.server.orm.entities.ClusterServiceEntityPK;
+
+import javax.persistence.EntityManager;
+
+public class ClusterServiceDAO {
+ @Inject
+ EntityManager entityManager;
+
+ public ClusterServiceEntity findByPK(ClusterServiceEntityPK clusterServiceEntityPK) {
+ return entityManager.find(ClusterServiceEntity.class, clusterServiceEntityPK);
+ }
+
+ public ClusterServiceEntity findByClusterAndServiceNames(String clusterName, String serviceName) {
+ ClusterServiceEntityPK pk = new ClusterServiceEntityPK();
+ pk.setClusterName(clusterName);
+ pk.setServiceName(serviceName);
+ return findByPK(pk);
+ }
+
+ @Transactional
+ public void create(ClusterServiceEntity clusterServiceEntity) {
+ entityManager.persist(clusterServiceEntity);
+ }
+
+ @Transactional
+ public ClusterServiceEntity merge(ClusterServiceEntity clusterServiceEntity) {
+ return entityManager.merge(clusterServiceEntity);
+ }
+
+ @Transactional
+ public void remove(ClusterServiceEntity clusterServiceEntity) {
+ entityManager.remove(clusterServiceEntity);
+ }
+
+ @Transactional
+ public void removeByPK(ClusterServiceEntityPK clusterServiceEntityPK) {
+ remove(findByPK(clusterServiceEntityPK));
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterServiceDAO.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterStateDAO.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterStateDAO.java?rev=1384149&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterStateDAO.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterStateDAO.java Wed Sep 12 22:22:10 2012
@@ -0,0 +1,55 @@
+/**
+ * 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.persist.Transactional;
+import org.apache.ambari.server.orm.entities.ClusterStateEntity;
+
+import javax.persistence.EntityManager;
+
+public class ClusterStateDAO {
+ @Inject
+ EntityManager entityManager;
+
+ public ClusterStateEntity findByPK(String clusterName) {
+ return entityManager.find(ClusterStateEntity.class, clusterName);
+ }
+
+ @Transactional
+ public void create(ClusterStateEntity clusterStateEntity) {
+ entityManager.persist(clusterStateEntity);
+ }
+
+ @Transactional
+ public ClusterStateEntity merge(ClusterStateEntity clusterStateEntity) {
+ return entityManager.merge(clusterStateEntity);
+ }
+
+ @Transactional
+ public void remove(ClusterStateEntity clusterStateEntity) {
+ entityManager.remove(clusterStateEntity);
+ }
+
+ @Transactional
+ public void removeByPK(String clusterName) {
+ remove(findByPK(clusterName));
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterStateDAO.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ComponentHostDesiredStateDAO.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ComponentHostDesiredStateDAO.java?rev=1384149&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ComponentHostDesiredStateDAO.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ComponentHostDesiredStateDAO.java Wed Sep 12 22:22:10 2012
@@ -0,0 +1,56 @@
+/**
+ * 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.persist.Transactional;
+import org.apache.ambari.server.orm.entities.ComponentHostDesiredStateEntity;
+import org.apache.ambari.server.orm.entities.ComponentHostDesiredStateEntityPK;
+
+import javax.persistence.EntityManager;
+
+public class ComponentHostDesiredStateDAO {
+ @Inject
+ EntityManager entityManager;
+
+ public ComponentHostDesiredStateEntity findByPK(ComponentHostDesiredStateEntityPK primaryKey) {
+ return entityManager.find(ComponentHostDesiredStateEntity.class, primaryKey);
+ }
+
+ @Transactional
+ public void create(ComponentHostDesiredStateEntity componentHostDesiredStateEntity) {
+ entityManager.persist(componentHostDesiredStateEntity);
+ }
+
+ @Transactional
+ public ComponentHostDesiredStateEntity merge(ComponentHostDesiredStateEntity componentHostDesiredStateEntity) {
+ return entityManager.merge(componentHostDesiredStateEntity);
+ }
+
+ @Transactional
+ public void remove(ComponentHostDesiredStateEntity componentHostDesiredStateEntity) {
+ entityManager.remove(componentHostDesiredStateEntity);
+ }
+
+ @Transactional
+ public void removeByPK(ComponentHostDesiredStateEntityPK primaryKey) {
+ remove(findByPK(primaryKey));
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ComponentHostDesiredStateDAO.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentMappingDAO.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentMappingDAO.java?rev=1384149&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentMappingDAO.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentMappingDAO.java Wed Sep 12 22:22:10 2012
@@ -0,0 +1,56 @@
+/**
+ * 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.persist.Transactional;
+import org.apache.ambari.server.orm.entities.HostComponentMappingEntity;
+import org.apache.ambari.server.orm.entities.HostComponentStateEntityPK;
+
+import javax.persistence.EntityManager;
+
+public class HostComponentMappingDAO {
+ @Inject
+ EntityManager entityManager;
+
+ public HostComponentMappingEntity findByPK(HostComponentStateEntityPK primaryKey) {
+ return entityManager.find(HostComponentMappingEntity.class, primaryKey);
+ }
+
+ @Transactional
+ public void create(HostComponentMappingEntity hostComponentMappingEntity) {
+ entityManager.persist(hostComponentMappingEntity);
+ }
+
+ @Transactional
+ public HostComponentMappingEntity merge(HostComponentMappingEntity hostComponentMappingEntity) {
+ return entityManager.merge(hostComponentMappingEntity);
+ }
+
+ @Transactional
+ public void remove(HostComponentMappingEntity hostComponentMappingEntity) {
+ entityManager.remove(hostComponentMappingEntity);
+ }
+
+ @Transactional
+ public void removeByPK(HostComponentStateEntityPK primaryKey) {
+ remove(findByPK(primaryKey));
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentMappingDAO.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentStateDAO.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentStateDAO.java?rev=1384149&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentStateDAO.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentStateDAO.java Wed Sep 12 22:22:10 2012
@@ -0,0 +1,56 @@
+/**
+ * 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.persist.Transactional;
+import org.apache.ambari.server.orm.entities.HostComponentStateEntity;
+import org.apache.ambari.server.orm.entities.HostComponentStateEntityPK;
+
+import javax.persistence.EntityManager;
+
+public class HostComponentStateDAO {
+ @Inject
+ EntityManager entityManager;
+
+ public HostComponentStateEntity findByPK(HostComponentStateEntityPK primaryKey) {
+ return entityManager.find(HostComponentStateEntity.class, primaryKey);
+ }
+
+ @Transactional
+ public void create(HostComponentStateEntity hostComponentStateEntity) {
+ entityManager.persist(hostComponentStateEntity);
+ }
+
+ @Transactional
+ public HostComponentStateEntity merge(HostComponentStateEntity hostComponentStateEntity) {
+ return entityManager.merge(hostComponentStateEntity);
+ }
+
+ @Transactional
+ public void remove(HostComponentStateEntity hostComponentStateEntity) {
+ entityManager.remove(hostComponentStateEntity);
+ }
+
+ @Transactional
+ public void removeByPK(HostComponentStateEntityPK primaryKey) {
+ remove(findByPK(primaryKey));
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentStateDAO.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostDAO.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostDAO.java?rev=1384149&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostDAO.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostDAO.java Wed Sep 12 22:22:10 2012
@@ -0,0 +1,56 @@
+/**
+ * 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.persist.Transactional;
+import org.apache.ambari.server.orm.entities.HostEntity;
+
+import javax.persistence.EntityManager;
+
+public class HostDAO {
+
+ @Inject
+ EntityManager entityManager;
+
+ public HostEntity findByName(String hostName) {
+ return entityManager.find(HostEntity.class, hostName);
+ }
+
+ @Transactional
+ public void create(HostEntity hostEntity) {
+ entityManager.persist(hostEntity);
+ }
+
+ @Transactional
+ public HostEntity merge(HostEntity hostEntity) {
+ return entityManager.merge(hostEntity);
+ }
+
+ @Transactional
+ public void remove(HostEntity hostEntity) {
+ entityManager.remove(hostEntity);
+ }
+
+ @Transactional
+ public void removeByName(String hostName) {
+ remove(findByName(hostName));
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostDAO.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostStateDAO.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostStateDAO.java?rev=1384149&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostStateDAO.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostStateDAO.java Wed Sep 12 22:22:10 2012
@@ -0,0 +1,55 @@
+/**
+ * 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.persist.Transactional;
+import org.apache.ambari.server.orm.entities.HostStateEntity;
+
+import javax.persistence.EntityManager;
+
+public class HostStateDAO {
+ @Inject
+ EntityManager entityManager;
+
+ public HostStateEntity findByHostName(String hostName) {
+ return entityManager.find(HostStateEntity.class, hostName);
+ }
+
+ @Transactional
+ public void create(HostStateEntity hostStateEntity) {
+ entityManager.persist(hostStateEntity);
+ }
+
+ @Transactional
+ public HostStateEntity merge(HostStateEntity hostStateEntity) {
+ return entityManager.merge(hostStateEntity);
+ }
+
+ @Transactional
+ public void remove(HostStateEntity hostStateEntity) {
+ entityManager.remove(hostStateEntity);
+ }
+
+ @Transactional
+ public void removeByHostName(String hostName) {
+ remove(findByHostName(hostName));
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostStateDAO.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentConfigDAO.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentConfigDAO.java?rev=1384149&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentConfigDAO.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentConfigDAO.java Wed Sep 12 22:22:10 2012
@@ -0,0 +1,55 @@
+/**
+ * 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.persist.Transactional;
+import org.apache.ambari.server.orm.entities.ServiceComponentConfigEntity;
+
+import javax.persistence.EntityManager;
+
+public class ServiceComponentConfigDAO {
+ @Inject
+ EntityManager entityManager;
+
+ public ServiceComponentConfigEntity findByPK(Integer primaryKey) {
+ return entityManager.find(ServiceComponentConfigEntity.class, primaryKey);
+ }
+
+ @Transactional
+ public void create(ServiceComponentConfigEntity serviceComponentConfigEntity) {
+ entityManager.persist(serviceComponentConfigEntity);
+ }
+
+ @Transactional
+ public ServiceComponentConfigEntity merge(ServiceComponentConfigEntity serviceComponentConfigEntity) {
+ return entityManager.merge(serviceComponentConfigEntity);
+ }
+
+ @Transactional
+ public void remove(ServiceComponentConfigEntity serviceComponentConfigEntity) {
+ entityManager.remove(serviceComponentConfigEntity);
+ }
+
+ @Transactional
+ public void removeByPK(Integer primaryKey) {
+ remove(findByPK(primaryKey));
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentConfigDAO.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentHostConfigDAO.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentHostConfigDAO.java?rev=1384149&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentHostConfigDAO.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentHostConfigDAO.java Wed Sep 12 22:22:10 2012
@@ -0,0 +1,55 @@
+/**
+ * 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.persist.Transactional;
+import org.apache.ambari.server.orm.entities.ServiceComponentHostConfigEntity;
+
+import javax.persistence.EntityManager;
+
+public class ServiceComponentHostConfigDAO {
+ @Inject
+ EntityManager entityManager;
+
+ public ServiceComponentHostConfigEntity findByPK(Integer primaryKey) {
+ return entityManager.find(ServiceComponentHostConfigEntity.class, primaryKey);
+ }
+
+ @Transactional
+ public void create(ServiceComponentHostConfigEntity serviceComponentHostConfigEntity) {
+ entityManager.persist(serviceComponentHostConfigEntity);
+ }
+
+ @Transactional
+ public ServiceComponentHostConfigEntity merge(ServiceComponentHostConfigEntity serviceComponentHostConfigEntity) {
+ return entityManager.merge(serviceComponentHostConfigEntity);
+ }
+
+ @Transactional
+ public void remove(ServiceComponentHostConfigEntity serviceComponentHostConfigEntity) {
+ entityManager.remove(serviceComponentHostConfigEntity);
+ }
+
+ @Transactional
+ public void removeByPK(Integer primaryKey) {
+ remove(findByPK(primaryKey));
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentHostConfigDAO.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentStateDAO.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentStateDAO.java?rev=1384149&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentStateDAO.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentStateDAO.java Wed Sep 12 22:22:10 2012
@@ -0,0 +1,56 @@
+/**
+ * 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.persist.Transactional;
+import org.apache.ambari.server.orm.entities.ServiceComponentStateEntity;
+import org.apache.ambari.server.orm.entities.ServiceComponentStateEntityPK;
+
+import javax.persistence.EntityManager;
+
+public class ServiceComponentStateDAO {
+ @Inject
+ EntityManager entityManager;
+
+ public ServiceComponentStateEntity findByPK(ServiceComponentStateEntityPK primaryKey) {
+ return entityManager.find(ServiceComponentStateEntity.class, primaryKey);
+ }
+
+ @Transactional
+ public void create(ServiceComponentStateEntity serviceComponentStateEntity) {
+ entityManager.persist(serviceComponentStateEntity);
+ }
+
+ @Transactional
+ public ServiceComponentStateEntity merge(ServiceComponentStateEntity serviceComponentStateEntity) {
+ return entityManager.merge(serviceComponentStateEntity);
+ }
+
+ @Transactional
+ public void remove(ServiceComponentStateEntity serviceComponentStateEntity) {
+ entityManager.remove(serviceComponentStateEntity);
+ }
+
+ @Transactional
+ public void removeByPK(ServiceComponentStateEntityPK primaryKey) {
+ remove(findByPK(primaryKey));
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentStateDAO.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java?rev=1384149&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java Wed Sep 12 22:22:10 2012
@@ -0,0 +1,73 @@
+/**
+ * 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.persist.Transactional;
+import org.apache.ambari.server.orm.entities.ClusterServiceEntity;
+import org.apache.ambari.server.orm.entities.ServiceConfigEntity;
+
+import javax.persistence.EntityManager;
+import javax.persistence.TypedQuery;
+import java.util.List;
+
+public class ServiceConfigDAO {
+ @Inject
+ EntityManager entityManager;
+
+ public ServiceConfigEntity findByPK(Integer primaryKey) {
+ return entityManager.find(ServiceConfigEntity.class, primaryKey);
+ }
+
+ public List<ServiceConfigEntity> findByClusterService(ClusterServiceEntity clusterServiceEntity) {
+ TypedQuery<ServiceConfigEntity> query = entityManager.createQuery("select config " +
+ "from ServiceConfigEntity config " +
+ "join config.clusterServiceEntity clusterService " +
+ "where clusterService = :service", ServiceConfigEntity.class);
+ query.setParameter("service", clusterServiceEntity);
+ return query.getResultList();
+ }
+
+ public List<ServiceConfigEntity> findAll() {
+ TypedQuery<ServiceConfigEntity> query = entityManager.createQuery("select c from ServiceConfigEntity c"
+ , ServiceConfigEntity.class);
+ return query.getResultList();
+ }
+
+ @Transactional
+ public void create(ServiceConfigEntity serviceConfigEntity) {
+ entityManager.persist(serviceConfigEntity);
+ }
+
+ @Transactional
+ public ServiceConfigEntity merge(ServiceConfigEntity serviceConfigEntity) {
+ return entityManager.merge(serviceConfigEntity);
+ }
+
+ @Transactional
+ public void remove(ServiceConfigEntity serviceConfigEntity) {
+ entityManager.remove(serviceConfigEntity);
+ }
+
+ @Transactional
+ public void removeByPK(Integer primaryKey) {
+ remove(findByPK(primaryKey));
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceDesiredStateDAO.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceDesiredStateDAO.java?rev=1384149&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceDesiredStateDAO.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceDesiredStateDAO.java Wed Sep 12 22:22:10 2012
@@ -0,0 +1,56 @@
+/**
+ * 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.persist.Transactional;
+import org.apache.ambari.server.orm.entities.ServiceDesiredStateEntity;
+import org.apache.ambari.server.orm.entities.ServiceDesiredStateEntityPK;
+
+import javax.persistence.EntityManager;
+
+public class ServiceDesiredStateDAO {
+ @Inject
+ EntityManager entityManager;
+
+ public ServiceDesiredStateEntity findByPK(ServiceDesiredStateEntityPK primaryKey) {
+ return entityManager.find(ServiceDesiredStateEntity.class, primaryKey);
+ }
+
+ @Transactional
+ public void create(ServiceDesiredStateEntity serviceDesiredStateEntity) {
+ entityManager.persist(serviceDesiredStateEntity);
+ }
+
+ @Transactional
+ public ServiceDesiredStateEntity merge(ServiceDesiredStateEntity serviceDesiredStateEntity) {
+ return entityManager.merge(serviceDesiredStateEntity);
+ }
+
+ @Transactional
+ public void remove(ServiceDesiredStateEntity serviceDesiredStateEntity) {
+ entityManager.remove(serviceDesiredStateEntity);
+ }
+
+ @Transactional
+ public void removeByPK(ServiceDesiredStateEntityPK primaryKey) {
+ remove(findByPK(primaryKey));
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceDesiredStateDAO.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceStateDAO.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceStateDAO.java?rev=1384149&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceStateDAO.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceStateDAO.java Wed Sep 12 22:22:10 2012
@@ -0,0 +1,56 @@
+/**
+ * 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.persist.Transactional;
+import org.apache.ambari.server.orm.entities.ServiceStateEntity;
+import org.apache.ambari.server.orm.entities.ServiceStateEntityPK;
+
+import javax.persistence.EntityManager;
+
+public class ServiceStateDAO {
+ @Inject
+ EntityManager entityManager;
+
+ public ServiceStateEntity findByPK(ServiceStateEntityPK primaryKey) {
+ return entityManager.find(ServiceStateEntity.class, primaryKey);
+ }
+
+ @Transactional
+ public void create(ServiceStateEntity serviceStateEntity) {
+ entityManager.persist(serviceStateEntity);
+ }
+
+ @Transactional
+ public ServiceStateEntity merge(ServiceStateEntity serviceStateEntity) {
+ return entityManager.merge(serviceStateEntity);
+ }
+
+ @Transactional
+ public void remove(ServiceStateEntity serviceStateEntity) {
+ entityManager.remove(serviceStateEntity);
+ }
+
+ @Transactional
+ public void removeByPK(ServiceStateEntityPK primaryKey) {
+ remove(findByPK(primaryKey));
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceStateDAO.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ActionStatusEntity.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ActionStatusEntity.java?rev=1384149&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ActionStatusEntity.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ActionStatusEntity.java Wed Sep 12 22:22:10 2012
@@ -0,0 +1,208 @@
+/**
+ * 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.*;
+import java.util.Arrays;
+
+@javax.persistence.IdClass(ActionStatusEntityPK.class)
+@javax.persistence.Table(name = "actionstatus", schema = "ambari", catalog = "")
+@Entity
+public class ActionStatusEntity {
+
+ private String clusterName = "";
+
+ @javax.persistence.Column(name = "cluster_name", nullable = true, insertable = false, updatable = false)
+ @Id
+ public String getClusterName() {
+ return clusterName;
+ }
+
+ public void setClusterName(String clusterName) {
+ this.clusterName = clusterName;
+ }
+
+ 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 role = "";
+
+ @javax.persistence.Column(name = "role", nullable = false)
+ @Id
+ public String getRole() {
+ return role;
+ }
+
+ public void setRole(String role) {
+ this.role = role;
+ }
+
+ private Integer requestId = 0;
+
+ @javax.persistence.Column(name = "request_id", nullable = false)
+ @Id
+ public Integer getRequestId() {
+ return requestId;
+ }
+
+ public void setRequestId(Integer requestId) {
+ this.requestId = requestId;
+ }
+
+ private Integer stageId = 0;
+
+ @javax.persistence.Column(name = "stage_id", nullable = false)
+ @Id
+ public Integer getStageId() {
+ return stageId;
+ }
+
+ public void setStageId(Integer stageId) {
+ this.stageId = stageId;
+ }
+
+ private String event = "";
+
+ @javax.persistence.Column(name = "event", nullable = false)
+ @Basic
+ public String getEvent() {
+ return event;
+ }
+
+ public void setEvent(String event) {
+ this.event = event;
+ }
+
+ private Integer taskId = 0;
+
+ @javax.persistence.Column(name = "task_id", nullable = false)
+ @Basic
+ public Integer getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(Integer taskId) {
+ this.taskId = taskId;
+ }
+
+ private String status = "";
+
+ @javax.persistence.Column(name = "status", nullable = false)
+ @Basic
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ private String logInfo;
+
+ @javax.persistence.Column(name = "log_info")
+ @Basic
+ public String getLogInfo() {
+ return logInfo;
+ }
+
+ public void setLogInfo(String logInfo) {
+ this.logInfo = logInfo;
+ }
+
+ private byte[] continueCriteria;
+
+ @javax.persistence.Column(name = "continue_criteria")
+ @Basic
+ public byte[] getContinueCriteria() {
+ return continueCriteria;
+ }
+
+ public void setContinueCriteria(byte[] continueCriteria) {
+ this.continueCriteria = continueCriteria;
+ }
+
+ 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;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ ActionStatusEntity that = (ActionStatusEntity) o;
+
+ if (clusterName != null ? !clusterName.equals(that.clusterName) : that.clusterName != null) return false;
+ if (!Arrays.equals(continueCriteria, that.continueCriteria)) return false;
+ if (event != null ? !event.equals(that.event) : that.event != null) return false;
+ if (hostName != null ? !hostName.equals(that.hostName) : that.hostName != null) return false;
+ if (logInfo != null ? !logInfo.equals(that.logInfo) : that.logInfo != null) return false;
+ if (requestId != null ? !requestId.equals(that.requestId) : that.requestId != null) return false;
+ if (role != null ? !role.equals(that.role) : that.role != null) return false;
+ if (stageId != null ? !stageId.equals(that.stageId) : that.stageId != null) return false;
+ if (status != null ? !status.equals(that.status) : that.status != null) return false;
+ if (taskId != null ? !taskId.equals(that.taskId) : that.taskId != 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 + (role != null ? role.hashCode() : 0);
+ result = 31 * result + (requestId != null ? requestId.hashCode() : 0);
+ result = 31 * result + (stageId != null ? stageId.hashCode() : 0);
+ result = 31 * result + (event != null ? event.hashCode() : 0);
+ result = 31 * result + (taskId != null ? taskId.hashCode() : 0);
+ result = 31 * result + (status != null ? status.hashCode() : 0);
+ result = 31 * result + (logInfo != null ? logInfo.hashCode() : 0);
+ result = 31 * result + (continueCriteria != null ? Arrays.hashCode(continueCriteria) : 0);
+ return result;
+ }
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ActionStatusEntity.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ActionStatusEntityPK.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ActionStatusEntityPK.java?rev=1384149&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ActionStatusEntityPK.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ActionStatusEntityPK.java Wed Sep 12 22:22:10 2012
@@ -0,0 +1,112 @@
+/**
+ * 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 ActionStatusEntityPK implements Serializable {
+
+ private String clusterName;
+
+ @Id
+ @Column(name = "cluster_name")
+ public String getClusterName() {
+ return clusterName;
+ }
+
+ public void setClusterName(String clusterName) {
+ this.clusterName = clusterName;
+ }
+
+ private String hostName;
+
+ @Id
+ @Column(name = "host_name")
+ public String getHostName() {
+ return hostName;
+ }
+
+ public void setHostName(String hostName) {
+ this.hostName = hostName;
+ }
+
+ private String role;
+
+ @Id
+ @Column(name = "role")
+ public String getRole() {
+ return role;
+ }
+
+ public void setRole(String role) {
+ this.role = role;
+ }
+
+ private Integer requestId;
+
+ @Id
+ @Column(name = "request_id")
+ public Integer getRequestId() {
+ return requestId;
+ }
+
+ public void setRequestId(Integer requestId) {
+ this.requestId = requestId;
+ }
+
+ private Integer stageId;
+
+ @Id
+ @Column(name = "stage_id")
+ public Integer getStageId() {
+ return stageId;
+ }
+
+ public void setStageId(Integer stageId) {
+ this.stageId = stageId;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ ActionStatusEntityPK that = (ActionStatusEntityPK) o;
+
+ if (clusterName != null ? !clusterName.equals(that.clusterName) : that.clusterName != null) return false;
+ if (hostName != null ? !hostName.equals(that.hostName) : that.hostName != null) return false;
+ if (requestId != null ? !requestId.equals(that.requestId) : that.requestId != null) return false;
+ if (role != null ? !role.equals(that.role) : that.role != null) return false;
+ if (stageId != null ? !stageId.equals(that.stageId) : that.stageId != 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 + (role != null ? role.hashCode() : 0);
+ result = 31 * result + (requestId != null ? requestId.hashCode() : 0);
+ result = 31 * result + (stageId != null ? stageId.hashCode() : 0);
+ return result;
+ }
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ActionStatusEntityPK.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterEntity.java
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterEntity.java?rev=1384149&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterEntity.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterEntity.java Wed Sep 12 22:22:10 2012
@@ -0,0 +1,180 @@
+/**
+ * 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.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.persistence.*;
+import java.util.List;
+
+@Table(name = "clusters", schema = "ambari", catalog = "")
+@Entity
+public class ClusterEntity {
+
+ private static final Log log = LogFactory.getLog(ClusterEntity.class);
+
+ private String clusterName;
+
+ @Column(name = "cluster_name")
+ @Id
+ public String getClusterName() {
+ return clusterName;
+ }
+
+ public void setClusterName(String clusterName) {
+ this.clusterName = clusterName;
+ }
+
+ private String desiredClusterState = "";
+
+ @Column(name = "desired_cluster_state", nullable = false)
+ @Basic
+ public String getDesiredClusterState() {
+ return desiredClusterState;
+ }
+
+ public void setDesiredClusterState(String desiredClusterState) {
+ this.desiredClusterState = desiredClusterState;
+ }
+
+ private String clusterInfo = "";
+
+ @Column(name = "cluster_info", nullable = false)
+ @Basic
+ public String getClusterInfo() {
+ return clusterInfo;
+ }
+
+ public void setClusterInfo(String clusterInfo) {
+ this.clusterInfo = clusterInfo;
+ }
+
+ List<HostEntity> hostEntities;
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "clusterEntity")
+ public List<HostEntity> getHostEntities() {
+ return hostEntities;
+ }
+
+ public void setHostEntities(List<HostEntity> hostEntities) {
+ this.hostEntities = hostEntities;
+ }
+
+ List<ClusterServiceEntity> clusterServiceEntities;
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "clusterEntity")
+ public List<ClusterServiceEntity> getClusterServiceEntities() {
+ return clusterServiceEntities;
+ }
+
+ public void setClusterServiceEntities(List<ClusterServiceEntity> clusterServiceEntities) {
+ this.clusterServiceEntities = clusterServiceEntities;
+ }
+
+ List<ActionStatusEntity> actionStatusEntities;
+
+ @OneToMany(mappedBy = "clusterEntity")
+ public List<ActionStatusEntity> getActionStatusEntities() {
+ return actionStatusEntities;
+ }
+
+ public void setActionStatusEntities(List<ActionStatusEntity> actionStatusEntities) {
+ this.actionStatusEntities = actionStatusEntities;
+ }
+
+ List<ComponentHostDesiredStateEntity> componentHostDesiredStateEntities;
+
+ @OneToMany(mappedBy = "clusterEntity")
+ public List<ComponentHostDesiredStateEntity> getComponentHostDesiredStateEntities() {
+ return componentHostDesiredStateEntities;
+ }
+
+ public void setComponentHostDesiredStateEntities(List<ComponentHostDesiredStateEntity> componentHostDesiredStateEntities) {
+ this.componentHostDesiredStateEntities = componentHostDesiredStateEntities;
+ }
+
+ private ClusterStateEntity clusterStateEntity;
+
+ @OneToOne(mappedBy = "clusterEntity")
+ public ClusterStateEntity getClusterStateEntity() {
+ return clusterStateEntity;
+ }
+
+ public void setClusterStateEntity(ClusterStateEntity clusterStateEntity) {
+ this.clusterStateEntity = clusterStateEntity;
+ }
+
+ private List<HostStateEntity> hostStateEntities;
+
+ @OneToMany(mappedBy = "clusterEntity")
+ public List<HostStateEntity> getHostStateEntities() {
+ return hostStateEntities;
+ }
+
+ public void setHostStateEntities(List<HostStateEntity> hostStateEntities) {
+ this.hostStateEntities = hostStateEntities;
+ }
+
+ private List<HostComponentStateEntity> hostComponentStateEntities;
+
+ @OneToMany(mappedBy = "clusterEntity")
+ public List<HostComponentStateEntity> getHostComponentStateEntities() {
+ return hostComponentStateEntities;
+ }
+
+ public void setHostComponentStateEntities(List<HostComponentStateEntity> hostComponentStateEntities) {
+ this.hostComponentStateEntities = hostComponentStateEntities;
+ }
+
+ private List<ServiceComponentStateEntity> serviceComponentStateEntities;
+
+ @OneToMany(mappedBy = "clusterEntity")
+ public List<ServiceComponentStateEntity> getServiceComponentStateEntities() {
+ return serviceComponentStateEntities;
+ }
+
+ public void setServiceComponentStateEntities(List<ServiceComponentStateEntity> serviceComponentStateEntities) {
+ this.serviceComponentStateEntities = serviceComponentStateEntities;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ ClusterEntity that = (ClusterEntity) o;
+
+ if (clusterInfo != null ? !clusterInfo.equals(that.clusterInfo) : that.clusterInfo != null) return false;
+ if (clusterName != null ? !clusterName.equals(that.clusterName) : that.clusterName != null) return false;
+ if (desiredClusterState != null ? !desiredClusterState.equals(that.desiredClusterState) : that.desiredClusterState != null)
+ return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = clusterName != null ? clusterName.hashCode() : 0;
+ result = 31 * result + (desiredClusterState != null ? desiredClusterState.hashCode() : 0);
+ result = 31 * result + (clusterInfo != null ? clusterInfo.hashCode() : 0);
+ return result;
+ }
+
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterEntity.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: 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=1384149&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterServiceEntity.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterServiceEntity.java Wed Sep 12 22:22:10 2012
@@ -0,0 +1,165 @@
+/**
+ * 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.*;
+import java.util.List;
+
+@IdClass(ClusterServiceEntityPK.class)
+@Table(name = "clusterservices", schema = "ambari", catalog = "")
+@Entity
+public class ClusterServiceEntity {
+
+ private String clusterName;
+
+ @Column(name = "cluster_name", nullable = false, insertable = false, updatable = false)
+ @Id
+ public String getClusterName() {
+ return clusterName;
+ }
+
+ public void setClusterName(String clusterName) {
+ this.clusterName = clusterName;
+ }
+
+ private String serviceName;
+
+ @Column(name = "service_name")
+ @Id
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ private Integer serviceEnabled = 0;
+
+ @Column(name = "service_enabled", nullable = false)
+ @Basic
+ public Integer getServiceEnabled() {
+ return serviceEnabled;
+ }
+
+ public void setServiceEnabled(Integer serviceEnabled) {
+ this.serviceEnabled = serviceEnabled;
+ }
+
+ private ClusterEntity clusterEntity;
+
+ @ManyToOne
+ @JoinColumn(name = "cluster_name")
+ public ClusterEntity getClusterEntity() {
+ return clusterEntity;
+ }
+
+ public void setClusterEntity(ClusterEntity clusterEntity) {
+ this.clusterEntity = clusterEntity;
+ }
+
+ private List<ServiceConfigEntity> serviceConfigEntities;
+
+ @OneToMany(mappedBy = "clusterServiceEntity")
+ public List<ServiceConfigEntity> getServiceConfigEntities() {
+ return serviceConfigEntities;
+ }
+
+ public void setServiceConfigEntities(List<ServiceConfigEntity> serviceConfigEntities) {
+ this.serviceConfigEntities = serviceConfigEntities;
+ }
+
+ private List<ServiceComponentConfigEntity> serviceComponentConfigEntities;
+
+ @OneToMany(mappedBy = "clusterServiceEntity")
+ public List<ServiceComponentConfigEntity> getServiceComponentConfigEntities() {
+ return serviceComponentConfigEntities;
+ }
+
+ public void setServiceComponentConfigEntities(List<ServiceComponentConfigEntity> serviceComponentConfigEntities) {
+ this.serviceComponentConfigEntities = serviceComponentConfigEntities;
+ }
+
+ private List<ServiceComponentHostConfigEntity> serviceComponentHostConfigEntities;
+
+ @OneToMany(mappedBy = "clusterServiceEntity")
+ public List<ServiceComponentHostConfigEntity> getServiceComponentHostConfigEntities() {
+ return serviceComponentHostConfigEntities;
+ }
+
+ public void setServiceComponentHostConfigEntities(List<ServiceComponentHostConfigEntity> serviceComponentHostConfigEntities) {
+ this.serviceComponentHostConfigEntities = serviceComponentHostConfigEntities;
+ }
+
+ private List<ServiceDesiredStateEntity> serviceDesiredStateEntities;
+
+ @OneToMany(mappedBy = "clusterServiceEntity")
+ public List<ServiceDesiredStateEntity> getServiceDesiredStateEntities() {
+ return serviceDesiredStateEntities;
+ }
+
+ public void setServiceDesiredStateEntities(List<ServiceDesiredStateEntity> serviceDesiredStateEntities) {
+ this.serviceDesiredStateEntities = serviceDesiredStateEntities;
+ }
+
+ private List<HostComponentMappingEntity> hostComponentMappingEntities;
+
+ @OneToMany(mappedBy = "clusterServiceEntity")
+ public List<HostComponentMappingEntity> getHostComponentMappingEntities() {
+ return hostComponentMappingEntities;
+ }
+
+ public void setHostComponentMappingEntities(List<HostComponentMappingEntity> hostComponentMappingEntities) {
+ this.hostComponentMappingEntities = hostComponentMappingEntities;
+ }
+
+ private List<ServiceStateEntity> serviceStateEntities;
+
+ @OneToMany(mappedBy = "clusterServiceEntity")
+ public List<ServiceStateEntity> getServiceStateEntities() {
+ return serviceStateEntities;
+ }
+
+ public void setServiceStateEntities(List<ServiceStateEntity> serviceStateEntities) {
+ this.serviceStateEntities = serviceStateEntities;
+ }
+
+ @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;
+ }
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterServiceEntity.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: 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=1384149&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterServiceEntityPK.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterServiceEntityPK.java Wed Sep 12 22:22:10 2012
@@ -0,0 +1,70 @@
+/**
+ * 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 ClusterServiceEntityPK implements Serializable {
+
+ private String clusterName;
+
+ @Id
+ @Column(name = "cluster_name")
+ public String getClusterName() {
+ return clusterName;
+ }
+
+ public void setClusterName(String clusterName) {
+ this.clusterName = clusterName;
+ }
+
+ private String serviceName;
+
+ @Id
+ @Column(name = "service_name")
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ ClusterServiceEntityPK that = (ClusterServiceEntityPK) o;
+
+ if (clusterName != null ? !clusterName.equals(that.clusterName) : that.clusterName != 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);
+ return result;
+ }
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterServiceEntityPK.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: 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=1384149&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterStateEntity.java (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterStateEntity.java Wed Sep 12 22:22:10 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.*;
+
+@javax.persistence.Table(name = "clusterstate", schema = "ambari", catalog = "")
+@Entity
+public class ClusterStateEntity {
+
+ private String clusterName;
+
+ @javax.persistence.Column(name = "cluster_name", insertable = false, updatable = false)
+ @Id
+ public String getClusterName() {
+ return clusterName;
+ }
+
+ public void setClusterName(String clusterName) {
+ this.clusterName = clusterName;
+ }
+
+ private String currentClusterState = "";
+
+ @javax.persistence.Column(name = "current_cluster_state", nullable = false)
+ @Basic
+ public String getCurrentClusterState() {
+ return currentClusterState;
+ }
+
+ public void setCurrentClusterState(String currentClusterState) {
+ 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;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ ClusterStateEntity that = (ClusterStateEntity) o;
+
+ if (clusterName != null ? !clusterName.equals(that.clusterName) : that.clusterName != null) return false;
+ if (currentClusterState != null ? !currentClusterState.equals(that.currentClusterState) : that.currentClusterState != null)
+ return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = clusterName != null ? clusterName.hashCode() : 0;
+ result = 31 * result + (currentClusterState != null ? currentClusterState.hashCode() : 0);
+ return result;
+ }
+}
Propchange: incubator/ambari/branches/AMBARI-666/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/ClusterStateEntity.java
------------------------------------------------------------------------------
svn:eol-style = native