cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahu...@apache.org
Subject [3/7] Moved VOs into the schema
Date Tue, 14 May 2013 20:05:05 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fa36120/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/VMReservationVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/VMReservationVO.java b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/VMReservationVO.java
new file mode 100644
index 0000000..5c4b870
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/VMReservationVO.java
@@ -0,0 +1,127 @@
+// 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.cloudstack.engine.cloud.entity;
+
+import java.util.Date;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+import com.cloud.utils.db.GenericDao;
+
+@Entity
+@Table(name = "vm_reservation")
+public class VMReservationVO implements Identity, InternalIdentity{
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private long id;
+
+    @Column(name = "vm_id")
+    private long vmId;
+
+    @Column(name="uuid")
+    private String uuid;
+
+    @Column(name="data_center_id")
+    private long dataCenterId;
+
+    @Column(name="pod_id")
+    private long podId;
+
+    @Column(name="cluster_id")
+    private long clusterId;
+
+    @Column(name="host_id")
+    private long hostId;
+
+    @Column(name=GenericDao.CREATED_COLUMN)
+    private Date created;
+
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    private Date removed;
+
+    // VolumeId -> poolId
+    @Transient
+    Map<Long,Long> volumeReservationMap;
+
+    /**
+     * There should never be a public constructor for this class. Since it's
+     * only here to define the table for the DAO class.
+     */
+    protected VMReservationVO() {
+    }
+
+    public VMReservationVO(long vmId, long dataCenterId, long podId, long clusterId, long hostId) {
+        this.vmId = vmId;
+        this.dataCenterId = dataCenterId;
+        this.podId = podId;
+        this.clusterId = clusterId;
+        this.hostId = hostId;
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+
+    public long getId() {
+        return id;
+    }
+
+    public long getVmId() {
+        return vmId;
+    }
+
+    @Override
+    public String getUuid() {
+        return uuid;
+    }
+
+    public long getDataCenterId() {
+        return dataCenterId;
+    }
+
+    public Long getPodId() {
+        return podId;
+    }
+
+    public Long getClusterId() {
+        return clusterId;
+    }
+
+    public Long getHostId() {
+        return hostId;
+    }
+
+    public Map<Long,Long> getVolumeReservation(){
+        return volumeReservationMap;
+    }
+
+    public void setVolumeReservation(Map<Long,Long> volumeReservationMap){
+        this.volumeReservationMap = volumeReservationMap;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fa36120/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/VMRootDiskTagVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/VMRootDiskTagVO.java b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/VMRootDiskTagVO.java
new file mode 100644
index 0000000..396aafb
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/VMRootDiskTagVO.java
@@ -0,0 +1,67 @@
+// 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.cloudstack.engine.cloud.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name = "vm_root_disk_tags")
+public class VMRootDiskTagVO implements InternalIdentity {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private long id;
+
+    @Column(name = "vm_id")
+    private long vmId;
+
+    @Column(name = "root_disk_tag")
+    private String rootDiskTag;
+
+    /**
+     * There should never be a public constructor for this class. Since it's
+     * only here to define the table for the DAO class.
+     */
+    protected VMRootDiskTagVO() {
+    }
+
+    public VMRootDiskTagVO(long vmId, String rootDiskTag) {
+        this.vmId = vmId;
+        this.rootDiskTag = rootDiskTag;
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public long getVmId() {
+        return vmId;
+    }
+
+    public String getRootDiskTag() {
+        return rootDiskTag;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fa36120/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/VolumeReservationVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/VolumeReservationVO.java b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/VolumeReservationVO.java
new file mode 100644
index 0000000..ecb0e68
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/VolumeReservationVO.java
@@ -0,0 +1,100 @@
+// 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.cloudstack.engine.cloud.entity;
+
+import java.util.Date;
+import java.util.Map;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+import com.cloud.utils.db.GenericDao;
+
+@Entity
+@Table(name = "volume_reservation")
+public class VolumeReservationVO implements InternalIdentity{
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private long id;
+
+    @Column(name = "vm_reservation_id")
+    private Long vmReservationId;
+
+    @Column(name = "vm_id")
+    private long vmId;
+
+    @Column(name="volume_id")
+    private long volumeId;
+
+    @Column(name="pool_id")
+    private long poolId;
+
+    // VolumeId -> poolId
+    @Transient
+    Map<String, String> volumeReservationMap;
+
+    /**
+     * There should never be a public constructor for this class. Since it's
+     * only here to define the table for the DAO class.
+     */
+    protected VolumeReservationVO() {
+    }
+
+    public VolumeReservationVO(long vmId, long volumeId, long poolId, Long vmReservationId) {
+        this.vmId = vmId;
+        this.volumeId = volumeId;
+        this.poolId = poolId;
+        this.vmReservationId = vmReservationId;
+    }
+
+
+    public long getId() {
+        return id;
+    }
+
+    public long getVmId() {
+        return vmId;
+    }
+
+    public Long geVmReservationId() {
+        return vmReservationId;
+    }
+
+    public long getVolumeId() {
+        return volumeId;
+    }
+
+    public Long getPoolId() {
+        return poolId;
+    }
+
+
+    public Map<String,String> getVolumeReservation(){
+        return volumeReservationMap;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fa36120/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMComputeTagDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMComputeTagDao.java b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMComputeTagDao.java
new file mode 100644
index 0000000..0123160
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMComputeTagDao.java
@@ -0,0 +1,31 @@
+// 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.cloudstack.engine.cloud.entity.dao;
+
+import java.util.List;
+
+import org.apache.cloudstack.engine.cloud.entity.VMComputeTagVO;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface VMComputeTagDao extends GenericDao<VMComputeTagVO, Long>{
+
+    void persist(long vmId, List<String> computeTags);
+
+    List<String> getComputeTags(long vmId);
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fa36120/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMComputeTagDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMComputeTagDaoImpl.java b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMComputeTagDaoImpl.java
new file mode 100644
index 0000000..9535926
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMComputeTagDaoImpl.java
@@ -0,0 +1,89 @@
+// 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.cloudstack.engine.cloud.entity.dao;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.Local;
+
+
+import org.apache.cloudstack.engine.cloud.entity.VMComputeTagVO;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+
+@Component
+@Local(value = { VMComputeTagDao.class })
+public class VMComputeTagDaoImpl extends GenericDaoBase<VMComputeTagVO, Long> implements VMComputeTagDao {
+
+    protected SearchBuilder<VMComputeTagVO> VmIdSearch;
+
+    public VMComputeTagDaoImpl() {
+    }
+
+    @PostConstruct
+    public void init() {
+        VmIdSearch = createSearchBuilder();
+        VmIdSearch.and("vmId", VmIdSearch.entity().getVmId(), SearchCriteria.Op.EQ);
+        VmIdSearch.done();
+
+    }
+
+    @Override
+    public void persist(long vmId, List<String> computeTags) {
+        Transaction txn = Transaction.currentTxn();
+
+        txn.start();
+        SearchCriteria<VMComputeTagVO> sc = VmIdSearch.create();
+        sc.setParameters("vmId", vmId);
+        expunge(sc);
+
+        for (String tag : computeTags) {
+            if(tag != null){
+                tag = tag.trim();
+                if(tag.length() > 0) {
+                    VMComputeTagVO vo = new VMComputeTagVO(vmId, tag);
+                    persist(vo);
+                }
+            }
+        }
+        txn.commit();
+    }
+
+    @Override
+    public List<String> getComputeTags(long vmId) {
+
+        SearchCriteria<VMComputeTagVO> sc = VmIdSearch.create();
+        sc.setParameters("vmId", vmId);
+
+        List<VMComputeTagVO> results = search(sc, null);
+        List<String> computeTags = new ArrayList<String>(results.size());
+        for (VMComputeTagVO result : results) {
+            computeTags.add(result.getComputeTag());
+        }
+
+        return computeTags;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fa36120/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMEntityDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMEntityDao.java b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMEntityDao.java
new file mode 100644
index 0000000..7f6b3c6
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMEntityDao.java
@@ -0,0 +1,41 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.engine.cloud.entity.dao;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.cloudstack.engine.cloud.entity.VMEntityVO;
+
+import com.cloud.utils.Pair;
+import com.cloud.utils.db.GenericDao;
+import com.cloud.utils.fsm.StateDao;
+import com.cloud.vm.VMInstanceVO;
+import com.cloud.vm.VirtualMachine;
+import com.cloud.vm.VirtualMachine.State;
+import com.cloud.vm.VirtualMachine.Type;
+
+
+/*
+ * Data Access Object for vm_instance table
+ */
+public interface VMEntityDao extends GenericDao<VMEntityVO, Long> {
+  
+    void loadVmReservation(VMEntityVO vm);
+    
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fa36120/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMEntityDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMEntityDaoImpl.java b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMEntityDaoImpl.java
new file mode 100644
index 0000000..bf153bc
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMEntityDaoImpl.java
@@ -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.cloudstack.engine.cloud.entity.dao;
+
+
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.Local;
+import javax.inject.Inject;
+
+import org.apache.cloudstack.engine.cloud.entity.VMEntityVO;
+import org.apache.cloudstack.engine.cloud.entity.VMReservationVO;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+
+import com.cloud.network.dao.NetworkDao;
+import com.cloud.network.dao.NetworkVO;
+import com.cloud.utils.Pair;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.Transaction;
+import com.cloud.vm.NicProfile;
+
+
+
+@Component
+@Local(value = { VMEntityDao.class })
+public class VMEntityDaoImpl extends GenericDaoBase<VMEntityVO, Long> implements VMEntityDao {
+
+    public static final Logger s_logger = Logger.getLogger(VMEntityDaoImpl.class);
+
+    
+    @Inject protected VMReservationDao _vmReservationDao;
+
+    @Inject protected VMComputeTagDao _vmComputeTagDao;
+    
+    @Inject protected VMRootDiskTagDao _vmRootDiskTagsDao;
+    
+    @Inject protected VMNetworkMapDao _vmNetworkMapDao;
+
+    
+    @Inject
+    protected NetworkDao _networkDao;
+    
+    public VMEntityDaoImpl() {
+    }
+    
+    @PostConstruct
+    protected void init() {
+
+    }
+
+    @Override
+    public void loadVmReservation(VMEntityVO vm) {
+        VMReservationVO vmReservation = _vmReservationDao.findByVmId(vm.getId());
+        vm.setVmReservation(vmReservation);
+    }
+
+    @Override
+    @DB
+    public VMEntityVO persist(VMEntityVO vm) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+
+        VMEntityVO dbVO = super.persist(vm);
+
+        saveVmNetworks(vm);
+        loadVmNetworks(dbVO);
+        saveVmReservation(vm);
+        loadVmReservation(dbVO);
+        saveComputeTags(vm.getId(), vm.getComputeTags());
+        loadComputeTags(dbVO);
+        saveRootDiskTags(vm.getId(), vm.getRootDiskTags());
+        loadRootDiskTags(dbVO);
+
+        txn.commit();
+
+        return dbVO;
+    }
+
+    private void loadVmNetworks(VMEntityVO dbVO) {
+        List<Long> networksIds = _vmNetworkMapDao.getNetworks(dbVO.getId());
+        
+        List<String> networks = new ArrayList<String>();
+        for(Long networkId : networksIds){
+            NetworkVO network = _networkDao.findById(networkId);
+            if(network != null){
+                networks.add(network.getUuid());
+            }
+        }
+        
+        dbVO.setNetworkIds(networks);
+        
+    }
+
+    private void saveVmNetworks(VMEntityVO vm) {
+        List<Long> networks = new ArrayList<Long>();
+        
+        List<String> networksIds = vm.getNetworkIds();
+        
+        if (networksIds == null || (networksIds != null && networksIds.isEmpty())) {
+            return;
+        }
+
+        
+        for(String uuid : networksIds){
+            NetworkVO network = _networkDao.findByUuid(uuid);
+            if(network != null){
+                networks.add(network.getId());
+            }
+        }
+        _vmNetworkMapDao.persist(vm.getId(), networks);
+        
+    }
+
+    private void loadRootDiskTags(VMEntityVO dbVO) {
+        List<String> rootDiskTags = _vmRootDiskTagsDao.getRootDiskTags(dbVO.getId());
+        dbVO.setRootDiskTags(rootDiskTags);
+        
+    }
+
+    private void loadComputeTags(VMEntityVO dbVO) {
+        List<String> computeTags = _vmComputeTagDao.getComputeTags(dbVO.getId());
+        dbVO.setComputeTags(computeTags);
+        
+    }
+
+    private void saveRootDiskTags(long vmId, List<String> rootDiskTags) {
+        if (rootDiskTags == null || (rootDiskTags != null && rootDiskTags.isEmpty())) {
+            return;
+        }
+        _vmRootDiskTagsDao.persist(vmId, rootDiskTags);
+        
+    }
+
+    private void saveComputeTags(long vmId, List<String> computeTags) {
+        if (computeTags == null || (computeTags != null && computeTags.isEmpty())) {
+            return;
+        }
+
+        _vmComputeTagDao.persist(vmId, computeTags);        
+    }
+
+    private void saveVmReservation(VMEntityVO vm) {
+        if(vm.getVmReservation() != null){
+            _vmReservationDao.persist(vm.getVmReservation());
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fa36120/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMNetworkMapDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMNetworkMapDao.java b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMNetworkMapDao.java
new file mode 100644
index 0000000..102339f
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMNetworkMapDao.java
@@ -0,0 +1,31 @@
+// 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.cloudstack.engine.cloud.entity.dao;
+
+import java.util.List;
+
+import org.apache.cloudstack.engine.cloud.entity.VMNetworkMapVO;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface VMNetworkMapDao extends GenericDao<VMNetworkMapVO, Long>{
+
+    void persist(long vmId, List<Long> networks);
+
+    List<Long> getNetworks(long vmId);
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fa36120/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMNetworkMapDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMNetworkMapDaoImpl.java b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMNetworkMapDaoImpl.java
new file mode 100644
index 0000000..f5d7036
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMNetworkMapDaoImpl.java
@@ -0,0 +1,87 @@
+// 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.cloudstack.engine.cloud.entity.dao;
+
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.annotation.PostConstruct;
+import javax.ejb.Local;
+import javax.inject.Inject;
+
+import org.apache.cloudstack.engine.cloud.entity.VMNetworkMapVO;
+
+import org.springframework.stereotype.Component;
+import com.cloud.network.dao.NetworkDao;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+
+@Component
+@Local(value = { VMNetworkMapDao.class })
+public class VMNetworkMapDaoImpl extends GenericDaoBase<VMNetworkMapVO, Long> implements VMNetworkMapDao {
+
+    protected SearchBuilder<VMNetworkMapVO> VmIdSearch;
+
+    @Inject
+    protected NetworkDao _networkDao;
+
+    public VMNetworkMapDaoImpl() {
+    }
+
+    @PostConstruct
+    public void init() {
+        VmIdSearch = createSearchBuilder();
+        VmIdSearch.and("vmId", VmIdSearch.entity().getVmId(), SearchCriteria.Op.EQ);
+        VmIdSearch.done();
+
+    }
+
+    @Override
+    public void persist(long vmId, List<Long> networks) {
+        Transaction txn = Transaction.currentTxn();
+
+        txn.start();
+        SearchCriteria<VMNetworkMapVO> sc = VmIdSearch.create();
+        sc.setParameters("vmId", vmId);
+        expunge(sc);
+
+        for (Long networkId : networks) {
+            VMNetworkMapVO vo = new VMNetworkMapVO(vmId, networkId);
+            persist(vo);
+        }
+
+        txn.commit();
+    }
+
+    @Override
+    public List<Long> getNetworks(long vmId) {
+
+        SearchCriteria<VMNetworkMapVO> sc = VmIdSearch.create();
+        sc.setParameters("vmId", vmId);
+
+        List<VMNetworkMapVO> results = search(sc, null);
+        List<Long> networks = new ArrayList<Long>(results.size());
+        for (VMNetworkMapVO result : results) {
+            networks.add(result.getNetworkId());
+        }
+
+        return networks;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fa36120/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMReservationDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMReservationDao.java b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMReservationDao.java
new file mode 100644
index 0000000..364d70c
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMReservationDao.java
@@ -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.cloudstack.engine.cloud.entity.dao;
+
+
+import java.util.Map;
+
+import org.apache.cloudstack.engine.cloud.entity.VMReservationVO;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface VMReservationDao extends GenericDao<VMReservationVO, Long>{
+
+    VMReservationVO findByVmId(long vmId);
+
+    void loadVolumeReservation(VMReservationVO reservation);
+
+    VMReservationVO findByReservationId(String reservationId);
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fa36120/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMReservationDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMReservationDaoImpl.java b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMReservationDaoImpl.java
new file mode 100644
index 0000000..d6723ed
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMReservationDaoImpl.java
@@ -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.cloudstack.engine.cloud.entity.dao;
+
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.Local;
+import javax.inject.Inject;
+
+import org.apache.cloudstack.engine.cloud.entity.VMEntityVO;
+import org.apache.cloudstack.engine.cloud.entity.VMReservationVO;
+import org.apache.cloudstack.engine.cloud.entity.VolumeReservationVO;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.host.dao.HostTagsDaoImpl;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+
+@Component
+@Local(value = { VMReservationDao.class })
+public class VMReservationDaoImpl extends GenericDaoBase<VMReservationVO, Long> implements VMReservationDao {
+
+    protected SearchBuilder<VMReservationVO> VmIdSearch;
+
+    @Inject protected VolumeReservationDao _volumeReservationDao;
+
+    public VMReservationDaoImpl() {
+    }
+
+    @PostConstruct
+    public void init() {
+        VmIdSearch = createSearchBuilder();
+        VmIdSearch.and("vmId", VmIdSearch.entity().getVmId(), SearchCriteria.Op.EQ);
+        VmIdSearch.done();
+    }
+
+    @Override
+    public VMReservationVO findByVmId(long vmId) {
+        SearchCriteria<VMReservationVO> sc = VmIdSearch.create("vmId", vmId);
+        VMReservationVO vmRes = findOneBy(sc);
+        loadVolumeReservation(vmRes);
+        return vmRes;
+    }
+
+
+    @Override
+    public void loadVolumeReservation(VMReservationVO reservation){
+        if(reservation != null){
+            List<VolumeReservationVO> volumeResList = _volumeReservationDao.listVolumeReservation(reservation.getId());
+            Map<Long, Long> volumeReservationMap = new HashMap<Long,Long>();
+
+            for(VolumeReservationVO res : volumeResList){
+                volumeReservationMap.put(res.getVolumeId(), res.getPoolId());
+            }
+            reservation.setVolumeReservation(volumeReservationMap);
+        }
+    }
+
+    @Override
+    @DB
+    public VMReservationVO persist(VMReservationVO reservation) {
+        Transaction txn = Transaction.currentTxn();
+        txn.start();
+
+        VMReservationVO dbVO = super.persist(reservation);
+
+        saveVolumeReservation(reservation);
+        loadVolumeReservation(dbVO);
+
+        txn.commit();
+
+        return dbVO;
+    }
+
+    private void saveVolumeReservation(VMReservationVO reservation) {
+        if(reservation.getVolumeReservation() != null){
+            for(Long volumeId : reservation.getVolumeReservation().keySet()){
+                VolumeReservationVO volumeReservation = new VolumeReservationVO(reservation.getVmId(), volumeId, reservation.getVolumeReservation().get(volumeId), reservation.getId());
+                _volumeReservationDao.persist(volumeReservation);
+            }
+        }
+    }
+
+    @Override
+    public VMReservationVO findByReservationId(String reservationId) {
+        VMReservationVO vmRes = super.findByUuid(reservationId);
+        loadVolumeReservation(vmRes);
+        return vmRes;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fa36120/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMRootDiskTagDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMRootDiskTagDao.java b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMRootDiskTagDao.java
new file mode 100644
index 0000000..44d9036
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMRootDiskTagDao.java
@@ -0,0 +1,31 @@
+// 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.cloudstack.engine.cloud.entity.dao;
+
+import java.util.List;
+
+import org.apache.cloudstack.engine.cloud.entity.VMRootDiskTagVO;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface VMRootDiskTagDao extends GenericDao<VMRootDiskTagVO, Long>{
+
+    void persist(long vmId, List<String> diskTags);
+
+    List<String> getRootDiskTags(long vmId);
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fa36120/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMRootDiskTagDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMRootDiskTagDaoImpl.java b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMRootDiskTagDaoImpl.java
new file mode 100644
index 0000000..3f395ab
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VMRootDiskTagDaoImpl.java
@@ -0,0 +1,88 @@
+// 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.cloudstack.engine.cloud.entity.dao;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.Local;
+
+
+import org.apache.cloudstack.engine.cloud.entity.VMRootDiskTagVO;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+
+@Component
+@Local(value = { VMRootDiskTagDao.class })
+public class VMRootDiskTagDaoImpl extends GenericDaoBase<VMRootDiskTagVO, Long> implements VMRootDiskTagDao {
+
+    protected SearchBuilder<VMRootDiskTagVO> VmIdSearch;
+
+    public VMRootDiskTagDaoImpl() {
+    }
+
+    @PostConstruct
+    public void init() {
+        VmIdSearch = createSearchBuilder();
+        VmIdSearch.and("vmId", VmIdSearch.entity().getVmId(), SearchCriteria.Op.EQ);
+        VmIdSearch.done();
+
+    }
+
+    @Override
+    public void persist(long vmId, List<String> rootDiskTags) {
+        Transaction txn = Transaction.currentTxn();
+
+        txn.start();
+        SearchCriteria<VMRootDiskTagVO> sc = VmIdSearch.create();
+        sc.setParameters("vmId", vmId);
+        expunge(sc);
+
+        for (String tag : rootDiskTags) {
+            if(tag != null){
+                tag = tag.trim();
+                if(tag.length() > 0) {
+                    VMRootDiskTagVO vo = new VMRootDiskTagVO(vmId, tag);
+                    persist(vo);
+                }
+            }
+        }
+        txn.commit();
+    }
+
+
+    @Override
+    public List<String> getRootDiskTags(long vmId) {
+        SearchCriteria<VMRootDiskTagVO> sc = VmIdSearch.create();
+        sc.setParameters("vmId", vmId);
+
+        List<VMRootDiskTagVO> results = search(sc, null);
+        List<String> computeTags = new ArrayList<String>(results.size());
+        for (VMRootDiskTagVO result : results) {
+            computeTags.add(result.getRootDiskTag());
+        }
+        return computeTags;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fa36120/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VolumeReservationDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VolumeReservationDao.java b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VolumeReservationDao.java
new file mode 100644
index 0000000..80534d9
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VolumeReservationDao.java
@@ -0,0 +1,31 @@
+// 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.cloudstack.engine.cloud.entity.dao;
+
+import java.util.List;
+
+import org.apache.cloudstack.engine.cloud.entity.VolumeReservationVO;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface VolumeReservationDao extends GenericDao<VolumeReservationVO, Long>{
+
+   VolumeReservationVO findByVmId(long vmId);
+
+   List<VolumeReservationVO> listVolumeReservation(long vmReservationId);
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fa36120/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VolumeReservationDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VolumeReservationDaoImpl.java b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VolumeReservationDaoImpl.java
new file mode 100644
index 0000000..689628e
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/dao/VolumeReservationDaoImpl.java
@@ -0,0 +1,69 @@
+// 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.cloudstack.engine.cloud.entity.dao;
+
+
+import java.util.List;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.Local;
+import javax.inject.Inject;
+
+import org.apache.cloudstack.engine.cloud.entity.VMReservationVO;
+import org.apache.cloudstack.engine.cloud.entity.VolumeReservationVO;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.host.dao.HostTagsDaoImpl;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local(value = { VolumeReservationDao.class })
+public class VolumeReservationDaoImpl extends GenericDaoBase<VolumeReservationVO, Long> implements VolumeReservationDao {
+
+    protected SearchBuilder<VolumeReservationVO> VmIdSearch;
+    protected SearchBuilder<VolumeReservationVO> VmReservationIdSearch;
+
+    public VolumeReservationDaoImpl() {
+    }
+
+    @PostConstruct
+    public void init() {
+        VmIdSearch = createSearchBuilder();
+        VmIdSearch.and("vmId", VmIdSearch.entity().getVmId(), SearchCriteria.Op.EQ);
+        VmIdSearch.done();
+
+        VmReservationIdSearch = createSearchBuilder();
+        VmReservationIdSearch.and("vmReservationId", VmReservationIdSearch.entity().geVmReservationId(), SearchCriteria.Op.EQ);
+        VmReservationIdSearch.done();
+    }
+
+    @Override
+    public VolumeReservationVO findByVmId(long vmId) {
+        SearchCriteria<VolumeReservationVO> sc = VmIdSearch.create("vmId", vmId);
+        return findOneBy(sc);
+    }
+
+    @Override
+    public List<VolumeReservationVO> listVolumeReservation(long vmReservationId) {
+        SearchCriteria<VolumeReservationVO> sc = VmReservationIdSearch.create("vmReservationId", vmReservationId);
+        return listBy(sc);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fa36120/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/ClusterDetailsVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/ClusterDetailsVO.java b/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/ClusterDetailsVO.java
new file mode 100644
index 0000000..720a3fc
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/ClusterDetailsVO.java
@@ -0,0 +1,68 @@
+// Copyright 2012 Citrix Systems, Inc. Licensed under the
+// Apache License, Version 2.0 (the "License"); you may not use this
+// file except in compliance with the License.  Citrix Systems, Inc.
+// reserves all rights not expressly granted by 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.
+// 
+// Automatically generated by addcopyright.py at 04/03/2012
+package org.apache.cloudstack.engine.datacenter.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="cluster_details")
+public class ClusterDetailsVO {
+
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+    
+    @Column(name="cluster_id")
+    private long clusterId;
+    
+    @Column(name="name")
+    private String name;
+    
+    @Column(name="value")
+    private String value;
+    
+    protected ClusterDetailsVO() {
+    }
+    
+    public ClusterDetailsVO(long clusterId, String name, String value) {
+        this.clusterId = clusterId;
+        this.name = name;
+        this.value = value;
+    }
+
+    public long getClusterId() {
+        return clusterId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public long getId() {
+        return id;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fa36120/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/DcDetailVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/DcDetailVO.java b/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/DcDetailVO.java
new file mode 100644
index 0000000..c67c8eb
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/DcDetailVO.java
@@ -0,0 +1,67 @@
+// Copyright 2012 Citrix Systems, Inc. Licensed under the
+// Apache License, Version 2.0 (the "License"); you may not use this
+// file except in compliance with the License.  Citrix Systems, Inc.
+// reserves all rights not expressly granted by 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.
+// 
+// Automatically generated by addcopyright.py at 04/03/2012
+package org.apache.cloudstack.engine.datacenter.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="data_center_details")
+public class DcDetailVO {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+    
+    @Column(name="dc_id")
+    private long dcId;
+    
+    @Column(name="name")
+    private String name;
+    
+    @Column(name="value")
+    private String value;
+    
+    protected DcDetailVO() {
+    }
+    
+    public DcDetailVO(long dcId, String name, String value) {
+        this.dcId = dcId;
+        this.name = name;
+        this.value = value;
+    }
+
+    public long getDcId() {
+        return dcId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public long getId() {
+        return id;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fa36120/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/EngineCluster.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/EngineCluster.java b/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/EngineCluster.java
new file mode 100644
index 0000000..b95e131
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/EngineCluster.java
@@ -0,0 +1,23 @@
+// 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.cloudstack.engine.datacenter.entity;
+
+import com.cloud.org.Cluster;
+
+public interface EngineCluster extends Cluster {
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fa36120/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/EngineClusterVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/EngineClusterVO.java b/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/EngineClusterVO.java
new file mode 100644
index 0000000..c64fdf8
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/EngineClusterVO.java
@@ -0,0 +1,243 @@
+// Copyright 2012 Citrix Systems, Inc. Licensed under the
+// Apache License, Version 2.0 (the "License"); you may not use this
+// file except in compliance with the License.  Citrix Systems, Inc.
+// reserves all rights not expressly granted by 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.
+// 
+// Automatically generated by addcopyright.py at 04/03/2012
+package org.apache.cloudstack.engine.datacenter.entity;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State;
+import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State.Event;
+
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.org.Cluster;
+import com.cloud.org.Grouping;
+import com.cloud.org.Managed.ManagedState;
+import com.cloud.utils.NumbersUtil;
+import com.cloud.utils.db.GenericDao;
+import com.cloud.utils.db.StateMachine;
+
+@Entity
+@Table(name="cluster")
+public class EngineClusterVO implements EngineCluster, Identity {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name="id")
+    long id;
+
+    @Column(name="name")
+    String name;
+
+    @Column(name="guid")
+    String guid;
+
+    @Column(name="data_center_id")
+    long dataCenterId;
+
+    @Column(name="pod_id")
+    long podId;
+
+    @Column(name="hypervisor_type")
+    String hypervisorType;
+
+    @Column(name="cluster_type")
+    @Enumerated(value=EnumType.STRING)
+    Cluster.ClusterType clusterType;
+
+    @Column(name="allocation_state")
+    @Enumerated(value=EnumType.STRING)
+    AllocationState allocationState;
+
+    @Column(name="managed_state")
+    @Enumerated(value=EnumType.STRING)
+    ManagedState managedState;
+
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    private Date removed;
+
+    @Column(name="uuid")
+    String uuid;
+
+    //orchestration
+
+    @Column(name="owner")
+    private String owner = null;
+
+    @Column(name=GenericDao.CREATED_COLUMN)
+    protected Date created;
+
+    @Column(name="lastUpdated", updatable=true)
+    @Temporal(value=TemporalType.TIMESTAMP)
+    protected Date lastUpdated;
+
+    /**
+     * Note that state is intentionally missing the setter.  Any updates to
+     * the state machine needs to go through the DAO object because someone
+     * else could be updating it as well.
+     */
+    @Enumerated(value=EnumType.STRING)
+    @StateMachine(state=State.class, event=Event.class)
+    @Column(name="engine_state", updatable=true, nullable=false, length=32)
+    protected State engineState = null;
+
+
+    public EngineClusterVO() {
+        clusterType = Cluster.ClusterType.CloudManaged;
+        allocationState = Grouping.AllocationState.Enabled;
+
+        this.uuid = UUID.randomUUID().toString();
+        this.engineState = State.Disabled;
+    }
+
+    public EngineClusterVO(long dataCenterId, long podId, String name) {
+        this.dataCenterId = dataCenterId;
+        this.podId = podId;
+        this.name = name;
+        this.clusterType = Cluster.ClusterType.CloudManaged;
+        this.allocationState = Grouping.AllocationState.Enabled;
+        this.managedState = ManagedState.Managed;
+        this.uuid = UUID.randomUUID().toString();
+        this.engineState = State.Disabled;
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public long getDataCenterId() {
+        return dataCenterId;
+    }
+
+    @Override
+    public long getPodId() {
+        return podId;
+    }
+
+    @Override
+    public Cluster.ClusterType getClusterType() {
+        return clusterType;
+    }
+
+    public void setClusterType(Cluster.ClusterType clusterType) {
+        this.clusterType = clusterType;
+    }
+
+    @Override
+    public AllocationState getAllocationState() {
+        return allocationState;
+    }
+
+    public void setAllocationState(AllocationState allocationState) {
+        this.allocationState = allocationState;
+    }
+
+    @Override
+    public ManagedState getManagedState() {
+        return managedState;
+    }
+
+    public void setManagedState(ManagedState managedState) {
+        this.managedState = managedState;
+    }
+
+    public EngineClusterVO(long clusterId) {
+        this.id = clusterId;
+    }
+
+    @Override
+    public int hashCode() {
+        return NumbersUtil.hash(id);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof EngineClusterVO)) {
+            return false;
+        }
+        EngineClusterVO that = (EngineClusterVO)obj;
+        return this.id == that.id;
+    }
+
+    @Override
+    public HypervisorType getHypervisorType() {
+        return HypervisorType.getType(hypervisorType);
+    }
+
+    public void setHypervisorType(String hy) {
+        hypervisorType = hy;
+    }
+
+    public String getGuid() {
+        return guid;
+    }
+
+    public void setGuid(String guid) {
+        this.guid = guid;
+    }
+
+    public Date getRemoved() {
+        return removed;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public String getUuid() {
+        return this.uuid;
+    }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+
+    public String getOwner() {
+        return owner;
+    }
+
+    public void setOwner(String owner) {
+        this.owner = owner;
+    }
+
+    public Date getCreated() {
+        return created;
+    }
+
+    public Date getLastUpdated() {
+        return lastUpdated;
+    }
+
+    public State getState() {
+        return engineState;
+    }    
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fa36120/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/EngineDataCenter.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/EngineDataCenter.java b/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/EngineDataCenter.java
new file mode 100644
index 0000000..027b0e6
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/EngineDataCenter.java
@@ -0,0 +1,23 @@
+// 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.cloudstack.engine.datacenter.entity;
+
+import com.cloud.dc.DataCenter;
+
+public interface EngineDataCenter extends DataCenter {
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fa36120/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/EngineDataCenterVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/EngineDataCenterVO.java b/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/EngineDataCenterVO.java
new file mode 100644
index 0000000..08d3085
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/EngineDataCenterVO.java
@@ -0,0 +1,504 @@
+// Copyright 2012 Citrix Systems, Inc. Licensed under the
+// Apache License, Version 2.0 (the "License"); you may not use this
+// file except in compliance with the License.  Citrix Systems, Inc.
+// reserves all rights not expressly granted by 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.
+//
+// Automatically generated by addcopyright.py at 04/03/2012
+package org.apache.cloudstack.engine.datacenter.entity;
+
+import java.util.Date;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.TableGenerator;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Transient;
+
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State;
+import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State.Event;
+
+
+import com.cloud.network.Network.Provider;
+import com.cloud.org.Grouping;
+import com.cloud.utils.NumbersUtil;
+import com.cloud.utils.db.GenericDao;
+import com.cloud.utils.db.StateMachine;
+
+@Entity
+@Table(name="data_center")
+public class EngineDataCenterVO implements EngineDataCenter, Identity {
+
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private long id;
+
+    @Column(name="name")
+    private String name = null;
+
+    @Column(name="description")
+    private String description = null;
+
+    @Column(name="dns1")
+    private String dns1 = null;
+
+    @Column(name="dns2")
+    private String dns2 = null;
+
+    @Column(name="ip6Dns1")
+    private String ip6Dns1 = null;
+
+    @Column(name="ip6Dns2")
+    private String ip6Dns2 = null;
+
+    @Column(name="internal_dns1")
+    private String internalDns1 = null;
+
+    @Column(name="internal_dns2")
+    private String internalDns2 = null;
+
+    @Column(name="router_mac_address", updatable = false, nullable=false)
+    private String routerMacAddress = "02:00:00:00:00:01";
+
+    @Column(name="guest_network_cidr")
+    private String guestNetworkCidr = null;
+
+    @Column(name="domain_id")
+    private Long domainId = null;
+
+    @Column(name="domain")
+    private String domain;
+
+    @Column(name="networktype")
+    @Enumerated(EnumType.STRING) 
+    NetworkType networkType;
+
+    @Column(name="dns_provider")
+    private String dnsProvider;
+
+    @Column(name="dhcp_provider")
+    private String dhcpProvider;
+
+    @Column(name="gateway_provider")
+    private String gatewayProvider;
+
+    @Column(name="vpn_provider")
+    private String vpnProvider;
+
+    @Column(name="userdata_provider")
+    private String userDataProvider;
+
+    @Column(name="lb_provider")
+    private String loadBalancerProvider;
+
+    @Column(name="firewall_provider")
+    private String firewallProvider;
+
+    @Column(name="mac_address", nullable=false)
+    @TableGenerator(name="mac_address_sq", table="data_center", pkColumnName="id", valueColumnName="mac_address", allocationSize=1)
+    private long macAddress = 1;
+
+    @Column(name="zone_token")
+    private String zoneToken;    
+
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    private Date removed;
+
+    // This is a delayed load value.  If the value is null,
+    // then this field has not been loaded yet.
+    // Call the dao to load it.
+    @Transient
+    Map<String, String> details;
+
+    @Column(name="allocation_state")
+    @Enumerated(value=EnumType.STRING)
+    AllocationState allocationState;
+
+    @Column(name="uuid")
+    private String uuid;    
+
+    @Column(name="is_security_group_enabled")
+    boolean securityGroupEnabled;
+
+    @Column(name="is_local_storage_enabled")
+    boolean localStorageEnabled;
+
+    //orchestration
+    @Column(name="owner")
+    private String owner = null;
+
+    @Column(name=GenericDao.CREATED_COLUMN)
+    protected Date created;
+
+    @Column(name="lastUpdated", updatable=true)
+    @Temporal(value=TemporalType.TIMESTAMP)
+    protected Date lastUpdated;
+
+    /**
+     * Note that state is intentionally missing the setter.  Any updates to
+     * the state machine needs to go through the DAO object because someone
+     * else could be updating it as well.
+     */
+    @Enumerated(value=EnumType.STRING)
+    @StateMachine(state=State.class, event=Event.class)
+    @Column(name="engine_state", updatable=true, nullable=false, length=32)
+    protected State engineState = null;
+
+
+    @Override
+    public String getDnsProvider() {
+        return dnsProvider;
+    }
+
+    public void setDnsProvider(String dnsProvider) {
+        this.dnsProvider = dnsProvider;
+    }
+
+    @Override
+    public String getDhcpProvider() {
+        return dhcpProvider;
+    }
+
+    public void setDhcpProvider(String dhcpProvider) {
+        this.dhcpProvider = dhcpProvider;
+    }
+
+    @Override
+    public String getGatewayProvider() {
+        return gatewayProvider;
+    }
+
+    public void setGatewayProvider(String gatewayProvider) {
+        this.gatewayProvider = gatewayProvider;
+    }
+
+    @Override
+    public String getLoadBalancerProvider() {
+        return loadBalancerProvider;
+    }
+
+    public void setLoadBalancerProvider(String loadBalancerProvider) {
+        this.loadBalancerProvider = loadBalancerProvider;
+    }
+
+    @Override
+    public String getFirewallProvider() {
+        return firewallProvider; 
+    }
+
+    public void setFirewallProvider(String firewallProvider) {
+        this.firewallProvider = firewallProvider;
+    }
+
+    public EngineDataCenterVO(long id, String name, String description, String dns1, String dns2, String dns3, String dns4, String guestCidr, String domain, Long domainId, NetworkType zoneType, String zoneToken, String domainSuffix) {
+        this(name, description, dns1, dns2, dns3, dns4, guestCidr, domain, domainId, zoneType, zoneToken, domainSuffix, false, false, null, null);
+        this.id = id;
+        this.allocationState = Grouping.AllocationState.Enabled;
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    public EngineDataCenterVO(String name, String description, String dns1, String dns2, String dns3, String dns4, String guestCidr, String domain, Long domainId, NetworkType zoneType, String zoneToken, String domainSuffix, boolean securityGroupEnabled, boolean localStorageEnabled, String ip6Dns1, String ip6Dns2) {
+        this.name = name;
+        this.description = description;
+        this.dns1 = dns1;
+        this.dns2 = dns2;
+        this.internalDns1 = dns3;
+        this.internalDns2 = dns4;
+        this.guestNetworkCidr = guestCidr;
+        this.domain = domain;
+        this.domainId = domainId;
+        this.networkType = zoneType;
+        this.allocationState = Grouping.AllocationState.Enabled;
+        this.securityGroupEnabled = securityGroupEnabled;
+        this.localStorageEnabled = localStorageEnabled;
+
+        if (zoneType == NetworkType.Advanced) {
+            loadBalancerProvider = Provider.VirtualRouter.getName();
+            firewallProvider = Provider.VirtualRouter.getName();
+            dhcpProvider = Provider.VirtualRouter.getName();
+            dnsProvider = Provider.VirtualRouter.getName();
+            gatewayProvider = Provider.VirtualRouter.getName();
+            vpnProvider = Provider.VirtualRouter.getName();
+            userDataProvider = Provider.VirtualRouter.getName();
+        } else if (zoneType == NetworkType.Basic){
+            dhcpProvider = Provider.VirtualRouter.getName();
+            dnsProvider = Provider.VirtualRouter.getName();
+            userDataProvider = Provider.VirtualRouter.getName();
+            loadBalancerProvider = Provider.ElasticLoadBalancerVm.getName();
+        }
+
+        this.zoneToken = zoneToken;
+        this.domain = domainSuffix;
+        this.uuid = UUID.randomUUID().toString();
+        this.engineState = State.Disabled;
+    }
+
+    @Override
+    public String getVpnProvider() {
+        return vpnProvider;
+    }
+
+    public void setVpnProvider(String vpnProvider) {
+        this.vpnProvider = vpnProvider;
+    }
+
+    @Override
+    public String getUserDataProvider() {
+        return userDataProvider;
+    }
+
+    public void setUserDataProvider(String userDataProvider) {
+        this.userDataProvider = userDataProvider;
+    }
+
+    @Override
+    public String getGuestNetworkCidr()
+    {
+        return guestNetworkCidr;
+    }
+
+    public void setGuestNetworkCidr(String guestNetworkCidr)
+    {
+        this.guestNetworkCidr = guestNetworkCidr;
+    }
+
+    @Override
+    public Long getDomainId() {
+        return domainId;
+    }
+
+    public void setDomainId(Long domainId) {
+        this.domainId = domainId;
+    }
+
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    public String getRouterMacAddress() {
+        return routerMacAddress;
+    }
+
+    @Override
+    public String getDns1() {
+        return dns1;
+    }
+
+    @Override
+    public String getDns2() {
+        return dns2;
+    }
+
+    @Override
+    public String getInternalDns1() {
+        return internalDns1;
+    }
+
+    @Override
+    public String getInternalDns2() {
+        return internalDns2;
+    }
+
+    protected EngineDataCenterVO() {
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public void setDns1(String dns1) {
+        this.dns1 = dns1;
+    }
+
+    public void setDns2(String dns2) {
+        this.dns2 = dns2;
+    }
+
+    public void setInternalDns1(String dns3) {
+        this.internalDns1 = dns3;
+    }
+
+    public void setInternalDns2(String dns4) {
+        this.internalDns2 = dns4;
+    }
+
+    public void setRouterMacAddress(String routerMacAddress) {
+        this.routerMacAddress = routerMacAddress;
+    }
+
+    @Override
+    public String getDomain() {
+        return domain;
+    }
+
+    public void setDomain(String domain) {
+        this.domain = domain;
+    }
+
+    public void setNetworkType(NetworkType zoneNetworkType) {
+        this.networkType = zoneNetworkType;
+    }
+
+    @Override
+    public NetworkType getNetworkType() {
+        return networkType;
+    }
+
+    @Override 
+    public boolean isSecurityGroupEnabled() {
+        return securityGroupEnabled;
+    }
+
+    public void setSecurityGroupEnabled(boolean enabled) {
+        this.securityGroupEnabled = enabled;
+    }
+
+    @Override
+    public boolean isLocalStorageEnabled() {
+        return localStorageEnabled;
+    }
+
+    public void setLocalStorageEnabled(boolean enabled) {
+        this.localStorageEnabled = enabled;
+    }
+
+    @Override
+    public Map<String, String> getDetails() {
+        return details;
+    }
+
+    @Override
+    public void setDetails(Map<String, String> details2) {
+        details = details2;        
+    }
+
+    public String getDetail(String name) {
+        assert (details != null) : "Did you forget to load the details?";
+
+        return details != null ? details.get(name) : null;
+    }
+
+    public void setDetail(String name, String value) {
+        assert (details != null) : "Did you forget to load the details?";
+
+        details.put(name, value);
+    }
+
+    @Override
+    public AllocationState getAllocationState() {
+        return allocationState;
+    }
+
+    public void setAllocationState(AllocationState allocationState) {
+        this.allocationState = allocationState;
+    }
+
+    @Override
+    public int hashCode() {
+        return NumbersUtil.hash(id);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof EngineDataCenterVO)) {
+            return false;
+        }
+        EngineDataCenterVO that = (EngineDataCenterVO)obj;
+        return this.id == that.id;
+    }
+
+    @Override
+    public String getZoneToken() {
+        return zoneToken;
+    }
+
+    public void setZoneToken(String zoneToken) {
+        this.zoneToken = zoneToken;
+    }
+
+    public Date getRemoved() {
+        return removed;
+    }
+
+    @Override
+    public String getUuid() {
+        return this.uuid;
+    }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+
+    public long getMacAddress() {
+        return macAddress;
+    }
+
+    public void setMacAddress(long macAddress) {
+        this.macAddress = macAddress;
+    }
+
+    public String getOwner() {
+        return owner;
+    }
+
+    public void setOwner(String owner) {
+        this.owner = owner;
+    }
+
+    public Date getCreated() {
+        return created;
+    }
+
+    public Date getLastUpdated() {
+        return lastUpdated;
+    }
+
+    public State getState() {
+        return engineState;
+    }
+
+	@Override
+	public String getIp6Dns1() {
+		return ip6Dns1;
+	}
+
+	public void setIp6Dns1(String ip6Dns1) {
+		this.ip6Dns1 = ip6Dns1;
+	}
+
+	@Override
+	public String getIp6Dns2() {
+		return ip6Dns2;
+	}
+
+	public void setIp6Dns2(String ip6Dns2) {
+		this.ip6Dns2 = ip6Dns2;
+	}
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fa36120/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/EngineHost.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/EngineHost.java b/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/EngineHost.java
new file mode 100644
index 0000000..82ab1f5
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/EngineHost.java
@@ -0,0 +1,24 @@
+// 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.cloudstack.engine.datacenter.entity;
+
+import com.cloud.host.Host;
+
+public interface EngineHost extends Host {
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fa36120/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/EngineHostPodVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/EngineHostPodVO.java b/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/EngineHostPodVO.java
new file mode 100644
index 0000000..3b78b85
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/engine/datacenter/entity/EngineHostPodVO.java
@@ -0,0 +1,245 @@
+// Copyright 2012 Citrix Systems, Inc. Licensed under the
+// Apache License, Version 2.0 (the "License"); you may not use this
+// file except in compliance with the License.  Citrix Systems, Inc.
+// reserves all rights not expressly granted by 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.
+//
+// Automatically generated by addcopyright.py at 04/03/2012
+package org.apache.cloudstack.engine.datacenter.entity;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State;
+import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State.Event;
+
+import com.cloud.org.Grouping;
+import com.cloud.utils.NumbersUtil;
+import com.cloud.utils.db.GenericDao;
+import com.cloud.utils.db.StateMachine;
+
+@Entity
+@Table(name = "host_pod_ref")
+public class EngineHostPodVO implements EnginePod, Identity {
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    long id;
+
+    @Column(name = "name")
+    private String name = null;
+
+    @Column(name = "data_center_id")
+    private long dataCenterId;
+
+    @Column(name = "gateway")
+    private String gateway;
+
+    @Column(name = "cidr_address")
+    private String cidrAddress;
+
+    @Column(name = "cidr_size")
+    private int cidrSize;
+
+    @Column(name = "description")
+    private String description;
+
+    @Column(name="allocation_state")
+    @Enumerated(value=EnumType.STRING)
+    AllocationState allocationState;
+
+    @Column(name = "external_dhcp")
+    private Boolean externalDhcp;
+
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    private Date removed;
+
+    @Column(name = "uuid")
+    private String uuid;
+
+    //orchestration
+    @Column(name="owner")
+    private String owner = null;
+
+    @Column(name=GenericDao.CREATED_COLUMN)
+    protected Date created;
+
+    @Column(name="lastUpdated", updatable=true)
+    @Temporal(value=TemporalType.TIMESTAMP)
+    protected Date lastUpdated;    
+
+    /**
+     * Note that state is intentionally missing the setter.  Any updates to
+     * the state machine needs to go through the DAO object because someone
+     * else could be updating it as well.
+     */
+    @Enumerated(value=EnumType.STRING)
+    @StateMachine(state=State.class, event=Event.class)
+    @Column(name="engine_state", updatable=true, nullable=false, length=32)
+    protected State engineState = null;
+
+    public EngineHostPodVO(String name, long dcId, String gateway, String cidrAddress, int cidrSize, String description) {
+        this.name = name;
+        this.dataCenterId = dcId;
+        this.gateway = gateway;
+        this.cidrAddress = cidrAddress;
+        this.cidrSize = cidrSize;
+        this.description = description;
+        this.allocationState = Grouping.AllocationState.Enabled;
+        this.externalDhcp = false;
+        this.uuid = UUID.randomUUID().toString();
+        this.engineState = State.Disabled;
+    }
+
+    /*
+     * public HostPodVO(String name, long dcId) { this(null, name, dcId); }
+     */
+    protected EngineHostPodVO() {
+        this.uuid = UUID.randomUUID().toString();
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public long getDataCenterId() {
+        return dataCenterId;
+    }
+
+    public void setDataCenterId(long dataCenterId) {
+        this.dataCenterId = dataCenterId;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public String getCidrAddress() {
+        return cidrAddress;
+    }
+
+    public void setCidrAddress(String cidrAddress) {
+        this.cidrAddress = cidrAddress;
+    }
+
+    @Override
+    public int getCidrSize() {
+        return cidrSize;
+    }
+
+    public void setCidrSize(int cidrSize) {
+        this.cidrSize = cidrSize;
+    }
+
+    @Override
+    public String getGateway() {
+        return gateway;
+    }
+
+    public void setGateway(String gateway) {
+        this.gateway = gateway;
+    }
+
+    @Override
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    @Override
+    public AllocationState getAllocationState() {
+        return allocationState;
+    }
+
+    public void setAllocationState(AllocationState allocationState) {
+        this.allocationState = allocationState;
+    }
+
+    // Use for comparisons only.
+    public EngineHostPodVO(Long id) {
+        this.id = id;
+    }
+
+    @Override
+    public int hashCode() {
+        return  NumbersUtil.hash(id);
+    }
+
+    @Override
+    public boolean getExternalDhcp() {
+        return externalDhcp;
+    }
+
+    public void setExternalDhcp(boolean use) {
+        externalDhcp = use;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof EngineHostPodVO) {
+            return id == ((EngineHostPodVO)obj).id;
+        } else {
+            return false;
+        }
+    }
+
+    public Date getRemoved() {
+        return removed;
+    }
+
+    @Override
+    public String getUuid() {
+        return this.uuid;
+    }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+
+    public String getOwner() {
+        return owner;
+    }
+
+    public void setOwner(String owner) {
+        this.owner = owner;
+    }
+
+    public Date getCreated() {
+        return created;
+    }
+
+    public Date getLastUpdated() {
+        return lastUpdated;
+    }
+
+    public State getState() {
+        return engineState;
+    }
+}


Mime
View raw message