Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 633EC10349 for ; Tue, 7 May 2013 22:01:23 +0000 (UTC) Received: (qmail 55472 invoked by uid 500); 7 May 2013 22:01:19 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 55403 invoked by uid 500); 7 May 2013 22:01:18 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 55041 invoked by uid 99); 7 May 2013 22:01:18 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 May 2013 22:01:18 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id E8CE8888EBD; Tue, 7 May 2013 22:01:17 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: alena1108@apache.org To: commits@cloudstack.apache.org Date: Tue, 07 May 2013 22:01:29 -0000 Message-Id: <288f3f6ba5d84a3faa4e3870a99d3684@git.apache.org> In-Reply-To: <3e79178248384d298e6dc53296a07b1f@git.apache.org> References: <3e79178248384d298e6dc53296a07b1f@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [13/72] [abbrv] [partial] Moved most of the VOs and DAOs from server package into engine-schema as well http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/maint/dao/AgentUpgradeDao.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/maint/dao/AgentUpgradeDao.java b/server/src/com/cloud/maint/dao/AgentUpgradeDao.java deleted file mode 100644 index e9763db..0000000 --- a/server/src/com/cloud/maint/dao/AgentUpgradeDao.java +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.maint.dao; - -import com.cloud.maint.AgentUpgradeVO; -import com.cloud.utils.db.GenericDao; - -public interface AgentUpgradeDao extends GenericDao { -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/maint/dao/AgentUpgradeDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/maint/dao/AgentUpgradeDaoImpl.java b/server/src/com/cloud/maint/dao/AgentUpgradeDaoImpl.java deleted file mode 100644 index 80c6d85..0000000 --- a/server/src/com/cloud/maint/dao/AgentUpgradeDaoImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.maint.dao; - -import javax.ejb.Local; - -import org.springframework.stereotype.Component; - -import com.cloud.maint.AgentUpgradeVO; -import com.cloud.utils.db.GenericDaoBase; - -@Component -@Local(AgentUpgradeDao.class) -public class AgentUpgradeDaoImpl extends GenericDaoBase implements AgentUpgradeDao { -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/migration/Db21to22MigrationUtil.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/migration/Db21to22MigrationUtil.java b/server/src/com/cloud/migration/Db21to22MigrationUtil.java deleted file mode 100755 index 66a7d59..0000000 --- a/server/src/com/cloud/migration/Db21to22MigrationUtil.java +++ /dev/null @@ -1,228 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.migration; - -import java.io.File; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.util.List; - -import javax.inject.Inject; - -import org.apache.log4j.xml.DOMConfigurator; - -import com.cloud.configuration.Resource; -import com.cloud.configuration.Resource.ResourceType; -import com.cloud.configuration.ResourceCountVO; -import com.cloud.configuration.dao.ConfigurationDao; -import com.cloud.configuration.dao.ResourceCountDao; -import com.cloud.dc.DataCenter.NetworkType; -import com.cloud.dc.DataCenterVO; -import com.cloud.dc.dao.ClusterDao; -import com.cloud.dc.dao.DataCenterDao; -import com.cloud.domain.DomainVO; -import com.cloud.domain.dao.DomainDao; -import com.cloud.host.dao.HostDao; -import com.cloud.resource.ResourceManager; -import com.cloud.user.Account; -import com.cloud.user.dao.AccountDao; -import com.cloud.utils.PropertiesUtil; -import com.cloud.utils.db.SearchBuilder; -import com.cloud.utils.db.SearchCriteria; -import com.cloud.utils.db.Transaction; -import com.cloud.vm.InstanceGroupVMMapVO; -import com.cloud.vm.InstanceGroupVO; -import com.cloud.vm.dao.InstanceGroupDao; -import com.cloud.vm.dao.InstanceGroupVMMapDao; - -public class Db21to22MigrationUtil { - - @Inject private ClusterDao _clusterDao; - @Inject private HostDao _hostDao; - @Inject private AccountDao _accountDao; - @Inject private DomainDao _domainDao; - @Inject private ResourceCountDao _resourceCountDao; - @Inject private InstanceGroupDao _vmGroupDao; - @Inject private InstanceGroupVMMapDao _groupVMMapDao; - @Inject private ConfigurationDao _configurationDao; - @Inject private DataCenterDao _zoneDao; - @Inject private ResourceManager _resourceMgr; - - private void doMigration() { - setupComponents(); - - migrateResourceCounts(); - - setupInstanceGroups(); - - migrateZones(); - - setupClusterGuid(); - - System.out.println("Migration done"); - } - - /* add guid in cluster table */ - private void setupClusterGuid() { - - //FIXME moving out XenServer code out of server. This upgrade step need to be taken care of - /* - XenServerConnectionPool _connPool = XenServerConnectionPool.getInstance(); - List clusters = _clusterDao.listByHyTypeWithoutGuid(HypervisorType.XenServer.toString()); - for (ClusterVO cluster : clusters) { - List hosts = _resourceMgr.listAllHostsInCluster(cluster.getId()); - for (HostVO host : hosts) { - String ip = host.getPrivateIpAddress(); - String username = host.getDetail("username"); - String password = host.getDetail("password"); - if (ip == null || ip.isEmpty() || username == null || username.isEmpty() || password == null - || password.isEmpty()) { - continue; - } - Queue pass=new LinkedList(); - pass.add(password); - Connection conn = _connPool.slaveConnect(ip, username, pass); - if (conn == null) - continue; - Pool.Record pr = null; - try { - pr = XenServerConnectionPool.getPoolRecord(conn); - } catch (Exception e) { - continue; - } finally { - try { - Session.localLogout(conn); - } catch (Exception e) { - } - } - cluster.setGuid(pr.uuid); - _clusterDao.update(cluster.getId(), cluster); - break; - } - } - */ - } - - - /** - * This method migrates the zones based on bug: 7204 - * based on the param direct.attach.untagged.vlan.enabled, we update zone to basic or advanced for 2.2 - */ - private void migrateZones(){ - try { - System.out.println("Migrating zones"); - String val = _configurationDao.getValue("direct.attach.untagged.vlan.enabled"); - NetworkType networkType; - if(val == null || val.equalsIgnoreCase("true")){ - networkType = NetworkType.Basic; - }else{ - networkType = NetworkType.Advanced; - } - List existingZones = _zoneDao.listAll(); - for(DataCenterVO zone : existingZones){ - zone.setNetworkType(networkType); - _zoneDao.update(zone.getId(), zone); - } - } catch (Exception e) { - System.out.println("Unhandled exception in migrateZones()" + e); - } - } - - private void migrateResourceCounts() { - System.out.println("migrating resource counts"); - SearchBuilder sb = _resourceCountDao.createSearchBuilder(); - sb.and("type", sb.entity().getType(), SearchCriteria.Op.EQ); - - for (ResourceType type : Resource.ResourceType.values()) { - SearchCriteria sc = sb.create(); - sc.setParameters("type", type); - - List resourceCounts = _resourceCountDao.search(sc, null); - for (ResourceCountVO resourceCount : resourceCounts) { - if (resourceCount.getAccountId() != null) { - Account acct = _accountDao.findById(resourceCount.getAccountId()); - Long domainId = acct.getDomainId(); - while (domainId != null) { - _resourceCountDao.updateDomainCount(domainId, type, true, resourceCount.getCount()); - DomainVO domain = _domainDao.findById(domainId); - domainId = domain.getParent(); - } - } - } - } - System.out.println("done migrating resource counts"); - } - - private void setupComponents() { - } - - private void setupInstanceGroups() { - System.out.println("setting up vm instance groups"); - - //Search for all the vms that have not null groups - Long vmId = 0L; - Long accountId = 0L; - String groupName; - Transaction txn = Transaction.open(Transaction.CLOUD_DB); - txn.start(); - try { - String request = "SELECT vm.id, uservm.account_id, vm.group from vm_instance vm, user_vm uservm where vm.group is not null and vm.removed is null and vm.id=uservm.id order by id"; - System.out.println(request); - PreparedStatement statement = txn.prepareStatement(request); - ResultSet result = statement.executeQuery(); - while (result.next()) { - vmId = result.getLong(1); - accountId = result.getLong(2); - groupName = result.getString(3); - InstanceGroupVO group = _vmGroupDao.findByAccountAndName(accountId, groupName); - //Create vm group if the group doesn't exist for this account - if (group == null) { - group = new InstanceGroupVO(groupName, accountId); - group = _vmGroupDao.persist(group); - System.out.println("Created new isntance group with name " + groupName + " for account id=" + accountId); - } - - if (group != null) { - InstanceGroupVMMapVO groupVmMapVO = new InstanceGroupVMMapVO(group.getId(), vmId); - _groupVMMapDao.persist(groupVmMapVO); - System.out.println("Assigned vm id=" + vmId + " to group with name " + groupName + " for account id=" + accountId); - } - } - txn.commit(); - statement.close(); - } catch (Exception e) { - System.out.println("Unhandled exception: " + e); - } finally { - txn.close(); - } - } - - - public static void main(String[] args) { - File file = PropertiesUtil.findConfigFile("log4j-cloud.xml"); - - if (file != null) { - System.out.println("Log4j configuration from : " + file.getAbsolutePath()); - DOMConfigurator.configureAndWatch(file.getAbsolutePath(), 10000); - } else { - System.out.println("Configure log4j with default properties"); - } - - new Db21to22MigrationUtil().doMigration(); - System.exit(0); - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/migration/Db22beta4to22GAMigrationUtil.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/migration/Db22beta4to22GAMigrationUtil.java b/server/src/com/cloud/migration/Db22beta4to22GAMigrationUtil.java deleted file mode 100644 index 4487d65..0000000 --- a/server/src/com/cloud/migration/Db22beta4to22GAMigrationUtil.java +++ /dev/null @@ -1,128 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.migration; - -import java.io.File; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -import org.apache.log4j.xml.DOMConfigurator; - -import com.cloud.utils.PropertiesUtil; -import com.cloud.utils.db.DB; -import com.cloud.utils.db.Transaction; -import com.cloud.utils.exception.CloudRuntimeException; - -@DB(txn=false) -public class Db22beta4to22GAMigrationUtil { - - private Map pfRuleIdToIpAddressIdMap = new HashMap(); - private final String FindPfIdToPublicIpId = "SELECT id,ip_address_id from firewall_rules where is_static_nat=1"; - private final String FindVmIdPerPfRule = "SELECT instance_id from port_forwarding_rules where id = ?"; - private final String WriteVmIdToIpAddrTable = "UPDATE user_ip_address set vm_id = ? where id = ?"; - protected Db22beta4to22GAMigrationUtil() { - } - - @DB - //This method gets us a map of pf/firewall id <-> ip address id - //Using the keyset, we will iterate over the pf table to find corresponding vm id - //When we get the vm id, we will use the val for each key to update the corresponding ip addr row with the vm id - public void populateMap(){ - Long key = null; - Long val = null; - - Transaction txn = Transaction.open(Transaction.CLOUD_DB); - - StringBuilder sql = new StringBuilder(FindPfIdToPublicIpId); - - PreparedStatement pstmt = null; - try { - pstmt = txn.prepareAutoCloseStatement(sql.toString()); - - ResultSet rs = pstmt.executeQuery(); - while (rs.next()) { - key = rs.getLong("id"); - val = rs.getLong("ip_address_id"); - pfRuleIdToIpAddressIdMap.put(key, val); - } - - } catch (SQLException e) { - throw new CloudRuntimeException("Unable to execute " + pstmt.toString(), e); - } - - } - - @DB - public void updateVmIdForIpAddresses(){ - Transaction txn = Transaction.open(Transaction.CLOUD_DB); - Set pfIds = pfRuleIdToIpAddressIdMap.keySet(); - StringBuilder sql = new StringBuilder(FindVmIdPerPfRule); - Long vmId = null; - Long ipAddressId = null; - PreparedStatement pstmt = null; - for(Long pfId : pfIds){ - try { - pstmt = txn.prepareAutoCloseStatement(sql.toString()); - pstmt.setLong(1, pfId); - ResultSet rs = pstmt.executeQuery(); - while(rs.next()) { - vmId = rs.getLong("instance_id"); - } - ipAddressId = pfRuleIdToIpAddressIdMap.get(pfId); - finallyUpdate(ipAddressId, vmId, txn); - } catch (SQLException e) { - throw new CloudRuntimeException("Unable to execute " + pstmt.toString(), e); - } - } - } - - @DB - public void finallyUpdate(Long ipAddressId, Long vmId, Transaction txn){ - - StringBuilder sql = new StringBuilder(WriteVmIdToIpAddrTable); - - PreparedStatement pstmt = null; - try { - pstmt = txn.prepareAutoCloseStatement(sql.toString()); - pstmt.setLong(1, vmId); - pstmt.setLong(2, ipAddressId); - int rs = pstmt.executeUpdate(); - } catch (SQLException e) { - throw new CloudRuntimeException("Unable to execute " + pstmt.toString(), e); - } - } - - public static void main(String[] args) { - - File file = PropertiesUtil.findConfigFile("log4j-cloud.xml"); - - if(file != null) { - System.out.println("Log4j configuration from : " + file.getAbsolutePath()); - DOMConfigurator.configureAndWatch(file.getAbsolutePath(), 10000); - } else { - System.out.println("Configure log4j with default properties"); - } - - Db22beta4to22GAMigrationUtil util = new Db22beta4to22GAMigrationUtil(); - util.populateMap(); - util.updateVmIdForIpAddresses(); - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/migration/DiskOffering20Dao.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/migration/DiskOffering20Dao.java b/server/src/com/cloud/migration/DiskOffering20Dao.java deleted file mode 100644 index ce22f48..0000000 --- a/server/src/com/cloud/migration/DiskOffering20Dao.java +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.migration; - -import com.cloud.utils.db.GenericDao; - -public interface DiskOffering20Dao extends GenericDao { -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/migration/DiskOffering20DaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/migration/DiskOffering20DaoImpl.java b/server/src/com/cloud/migration/DiskOffering20DaoImpl.java deleted file mode 100644 index e0eb40e..0000000 --- a/server/src/com/cloud/migration/DiskOffering20DaoImpl.java +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.migration; - -import javax.ejb.Local; - -import org.springframework.stereotype.Component; - -import com.cloud.utils.db.GenericDaoBase; - -@Local(value={DiskOffering20Dao.class}) -public class DiskOffering20DaoImpl extends GenericDaoBase implements DiskOffering20Dao { -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/migration/DiskOffering20VO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/migration/DiskOffering20VO.java b/server/src/com/cloud/migration/DiskOffering20VO.java deleted file mode 100644 index e50328d..0000000 --- a/server/src/com/cloud/migration/DiskOffering20VO.java +++ /dev/null @@ -1,113 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.migration; - -import java.util.Date; - -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 com.cloud.utils.db.GenericDao; -import org.apache.cloudstack.api.InternalIdentity; - -@Entity -@Table(name="disk_offering") -public class DiskOffering20VO implements InternalIdentity { - @Id - @GeneratedValue(strategy=GenerationType.IDENTITY) - @Column(name="id") - Long id; - - @Column(name="domain_id") - long domainId; - - @Column(name="name") - private String name = null; - - @Column(name="display_text") - private String displayText = null; - - @Column(name="disk_size") - long diskSize; - - @Column(name="mirrored") - boolean mirrored; - - @Column(name=GenericDao.REMOVED_COLUMN) - private Date removed; - - public DiskOffering20VO() { - } - - public DiskOffering20VO(long domainId, String name, String displayText, long diskSize, boolean mirrored) { - this.domainId = domainId; - this.name = name; - this.displayText = displayText; - this.diskSize = diskSize; - this.mirrored = mirrored; - } - - public long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - - public long getDomainId() { - return domainId; - } - public void setDomainId(long domainId) { - this.domainId = domainId; - } - - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - public String getDisplayText() { - return displayText; - } - public void setDisplayText(String displayText) { - this.displayText = displayText; - } - - public long getDiskSize() { - return diskSize; - } - public void setDiskSize(long diskSize) { - this.diskSize = diskSize; - } - - public boolean getMirrored() { - return mirrored; - } - public void setMirrored(boolean mirrored) { - this.mirrored = mirrored; - } - - public Date getRemoved() { - return removed; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/migration/DiskOffering21Dao.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/migration/DiskOffering21Dao.java b/server/src/com/cloud/migration/DiskOffering21Dao.java deleted file mode 100644 index 21781ea..0000000 --- a/server/src/com/cloud/migration/DiskOffering21Dao.java +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.migration; - -import com.cloud.utils.db.GenericDao; - -public interface DiskOffering21Dao extends GenericDao { -} - http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/migration/DiskOffering21DaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/migration/DiskOffering21DaoImpl.java b/server/src/com/cloud/migration/DiskOffering21DaoImpl.java deleted file mode 100644 index b67d8fb..0000000 --- a/server/src/com/cloud/migration/DiskOffering21DaoImpl.java +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.migration; - -import javax.ejb.Local; - -import org.springframework.stereotype.Component; - -import com.cloud.utils.db.GenericDaoBase; - -@Local(value={DiskOffering21Dao.class}) -public class DiskOffering21DaoImpl extends GenericDaoBase implements DiskOffering21Dao { -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/migration/DiskOffering21VO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/migration/DiskOffering21VO.java b/server/src/com/cloud/migration/DiskOffering21VO.java deleted file mode 100644 index 593f7ba..0000000 --- a/server/src/com/cloud/migration/DiskOffering21VO.java +++ /dev/null @@ -1,257 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.migration; - -import java.util.Date; -import java.util.List; - -import javax.persistence.Column; -import javax.persistence.DiscriminatorColumn; -import javax.persistence.DiscriminatorType; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; -import javax.persistence.Transient; - -import com.cloud.utils.db.GenericDao; -import org.apache.cloudstack.api.InternalIdentity; - -@Entity -@Table(name="disk_offering_21") -@Inheritance(strategy=InheritanceType.JOINED) -@DiscriminatorColumn(name="type", discriminatorType=DiscriminatorType.STRING, length=32) -public class DiskOffering21VO implements InternalIdentity { - public enum Type { - Disk, - Service - }; - - @Id - @GeneratedValue(strategy=GenerationType.AUTO) - @Column(name="id") - long id; - - @Column(name="domain_id") - Long domainId; - - @Column(name="unique_name") - private String uniqueName; - - @Column(name="name") - private String name = null; - - @Column(name="display_text") - private String displayText = null; - - @Column(name="disk_size") - long diskSize; - - @Column(name="mirrored") - boolean mirrored; - - @Column(name="tags") - String tags; - - @Column(name="type") - Type type; - - @Column(name=GenericDao.REMOVED_COLUMN) - private Date removed; - - @Column(name=GenericDao.CREATED_COLUMN) - private Date created; - - @Column(name="recreatable") - private boolean recreatable; - - @Column(name="use_local_storage") - private boolean useLocalStorage; - - @Column(name="system_use") - protected boolean systemUse; - - - public DiskOffering21VO() { - } - - public DiskOffering21VO(long domainId, String name, String displayText, long diskSize, boolean mirrored, String tags) { - this.domainId = domainId; - this.name = name; - this.displayText = displayText; - this.diskSize = diskSize; - this.mirrored = mirrored; - this.tags = tags; - this.recreatable = false; - this.type = Type.Disk; - this.useLocalStorage = false; - } - - public DiskOffering21VO(String name, String displayText, boolean mirrored, String tags, boolean recreatable, boolean useLocalStorage) { - this.domainId = null; - this.type = Type.Service; - this.name = name; - this.displayText = displayText; - this.mirrored = mirrored; - this.tags = tags; - this.recreatable = recreatable; - this.useLocalStorage = useLocalStorage; - } - - public long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getUniqueName() { - return uniqueName; - } - - public boolean getSystemUse() { - return systemUse; - } - - public void setSystemUse(boolean systemUse) { - this.systemUse = systemUse; - } - - public boolean getUseLocalStorage() { - return useLocalStorage; - } - - public void setUserLocalStorage(boolean useLocalStorage) { - this.useLocalStorage = useLocalStorage; - } - - public Long getDomainId() { - return domainId; - } - - public Type getType() { - return type; - } - - public void setType(Type type) { - this.type = type; - } - - public boolean isRecreatable() { - return recreatable; - } - - public void setDomainId(Long domainId) { - this.domainId = domainId; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDisplayText() { - return displayText; - } - public void setDisplayText(String displayText) { - this.displayText = displayText; - } - - public long getDiskSizeInBytes() { - return diskSize * 1024 * 1024; - } - - public void setDiskSize(long diskSize) { - this.diskSize = diskSize; - } - - public boolean isMirrored() { - return mirrored; - } - public void setMirrored(boolean mirrored) { - this.mirrored = mirrored; - } - - public Date getRemoved() { - return removed; - } - - public Date getCreated() { - return created; - } - - protected void setTags(String tags) { - this.tags = tags; - } - - public String getTags() { - return tags; - } - - public void setUniqueName(String name) { - this.uniqueName = name; - } - - @Transient - public String[] getTagsArray() { - String tags = getTags(); - if (tags == null || tags.isEmpty()) { - return new String[0]; - } - - return tags.split(","); - } - - @Transient - public boolean containsTag(String... tags) { - if (this.tags == null) { - return false; - } - - for (String tag : tags) { - if (!this.tags.matches(tag)) { - return false; - } - } - - return true; - } - - @Transient - public void setTagsArray(List newTags) { - if (newTags.isEmpty()) { - setTags(null); - return; - } - - StringBuilder buf = new StringBuilder(); - for (String tag : newTags) { - buf.append(tag).append(","); - } - - buf.delete(buf.length() - 1, buf.length()); - - setTags(buf.toString()); - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/migration/ServiceOffering20Dao.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/migration/ServiceOffering20Dao.java b/server/src/com/cloud/migration/ServiceOffering20Dao.java deleted file mode 100644 index e87b684..0000000 --- a/server/src/com/cloud/migration/ServiceOffering20Dao.java +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.migration; - -import com.cloud.utils.db.GenericDao; - -public interface ServiceOffering20Dao extends GenericDao { -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/migration/ServiceOffering20DaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/migration/ServiceOffering20DaoImpl.java b/server/src/com/cloud/migration/ServiceOffering20DaoImpl.java deleted file mode 100644 index f67949e..0000000 --- a/server/src/com/cloud/migration/ServiceOffering20DaoImpl.java +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.migration; - -import javax.ejb.Local; - -import org.springframework.stereotype.Component; - -import com.cloud.utils.db.GenericDaoBase; - -@Local(value={ServiceOffering20Dao.class}) -public class ServiceOffering20DaoImpl extends GenericDaoBase implements ServiceOffering20Dao { -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/migration/ServiceOffering20VO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/migration/ServiceOffering20VO.java b/server/src/com/cloud/migration/ServiceOffering20VO.java deleted file mode 100644 index bed29ec..0000000 --- a/server/src/com/cloud/migration/ServiceOffering20VO.java +++ /dev/null @@ -1,199 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.migration; - -import java.util.Date; - -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 com.cloud.dc.Vlan; -import com.cloud.dc.Vlan.VlanType; -import com.cloud.utils.db.GenericDao; -import org.apache.cloudstack.api.InternalIdentity; - -@Entity -@Table(name="service_offering") -public class ServiceOffering20VO implements InternalIdentity { - @Id - @GeneratedValue(strategy=GenerationType.IDENTITY) - @Column(name="id") - private Long id = null; - - @Column(name="name") - private String name = null; - - @Column(name="cpu") - private int cpu; - - @Column(name="speed") - private int speed; - - @Column(name="ram_size") - private int ramSize; - - @Column(name="nw_rate") - private int rateMbps; - - @Column(name="mc_rate") - private int multicastRateMbps; - - @Column(name="mirrored") - private boolean mirroredVolumes; - - @Column(name="ha_enabled") - private boolean offerHA; - - @Column(name="display_text") - private String displayText = null; - - @Column(name="guest_ip_type") - @Enumerated(EnumType.STRING) - private Vlan.VlanType guestIpType = Vlan.VlanType.VirtualNetwork; - - @Column(name="use_local_storage") - private boolean useLocalStorage; - - @Column(name=GenericDao.CREATED_COLUMN) - private Date created; - - @Column(name=GenericDao.REMOVED_COLUMN) - private Date removed; - - protected ServiceOffering20VO() { - } - - public ServiceOffering20VO(Long id, String name, int cpu, int ramSize, int speed, int rateMbps, int multicastRateMbps, boolean offerHA, String displayText, boolean localStorageRequired) { - this(id, name, cpu, ramSize, speed, rateMbps, multicastRateMbps, offerHA, displayText, Vlan.VlanType.VirtualNetwork, localStorageRequired); - } - - public ServiceOffering20VO(Long id, String name, int cpu, int ramSize, int speed, int rateMbps, int multicastRateMbps, boolean offerHA, String displayText, VlanType guestIpType, boolean useLocalStorage) { - this.id = id; - this.name = name; - this.cpu = cpu; - this.ramSize = ramSize; - this.speed = speed; - this.rateMbps = rateMbps; - this.multicastRateMbps = multicastRateMbps; - this.offerHA = offerHA; - this.displayText = displayText; - this.guestIpType = guestIpType; - this.useLocalStorage = useLocalStorage; - } - - public boolean getOfferHA() { - return offerHA; - } - - public void setOfferHA(boolean offerHA) { - this.offerHA = offerHA; - } - - public long getId() { - return id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public int getCpu() { - return cpu; - } - - public void setCpu(int cpu) { - this.cpu = cpu; - } - - public void setSpeed(int speed) { - this.speed = speed; - } - - public void setRamSize(int ramSize) { - this.ramSize = ramSize; - } - - public int getSpeed() { - return speed; - } - - public int getRamSize() { - return ramSize; - } - - public Date getCreated() { - return created; - } - - public Date getRemoved() { - return removed; - } - - public void setMirroredVolumes(boolean mirroredVolumes) { - this.mirroredVolumes = mirroredVolumes; - } - - public boolean isMirroredVolumes() { - return mirroredVolumes; - } - - public String getDisplayText() { - return displayText; - } - - public void setDisplayText(String displayText) { - this.displayText = displayText; - } - - public void setRateMbps(int rateMbps) { - this.rateMbps = rateMbps; - } - - public int getRateMbps() { - return rateMbps; - } - - public void setMulticastRateMbps(int multicastRateMbps) { - this.multicastRateMbps = multicastRateMbps; - } - - public int getMulticastRateMbps() { - return multicastRateMbps; - } - - public void setGuestIpType(Vlan.VlanType guestIpType) { - this.guestIpType = guestIpType; - } - - public Vlan.VlanType getGuestIpType() { - return guestIpType; - } - - public boolean getUseLocalStorage() { - return useLocalStorage; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/migration/ServiceOffering21Dao.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/migration/ServiceOffering21Dao.java b/server/src/com/cloud/migration/ServiceOffering21Dao.java deleted file mode 100644 index eece426..0000000 --- a/server/src/com/cloud/migration/ServiceOffering21Dao.java +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.migration; - -import com.cloud.utils.db.GenericDao; - -public interface ServiceOffering21Dao extends GenericDao { -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/migration/ServiceOffering21DaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/migration/ServiceOffering21DaoImpl.java b/server/src/com/cloud/migration/ServiceOffering21DaoImpl.java deleted file mode 100644 index ce24191..0000000 --- a/server/src/com/cloud/migration/ServiceOffering21DaoImpl.java +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.migration; - -import javax.ejb.Local; - -import org.springframework.stereotype.Component; - -import com.cloud.utils.db.GenericDaoBase; - -@Local(value={ServiceOffering21Dao.class}) -public class ServiceOffering21DaoImpl extends GenericDaoBase implements ServiceOffering21Dao { -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/migration/ServiceOffering21VO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/migration/ServiceOffering21VO.java b/server/src/com/cloud/migration/ServiceOffering21VO.java deleted file mode 100644 index d07be64..0000000 --- a/server/src/com/cloud/migration/ServiceOffering21VO.java +++ /dev/null @@ -1,178 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.migration; - -import javax.persistence.Column; -import javax.persistence.DiscriminatorValue; -import javax.persistence.Entity; -import javax.persistence.PrimaryKeyJoinColumn; -import javax.persistence.Table; -import javax.persistence.Transient; - -import com.cloud.offering.ServiceOffering; - -@Entity -@Table(name="service_offering_21") -@DiscriminatorValue(value="Service") -@PrimaryKeyJoinColumn(name="id") -public class ServiceOffering21VO extends DiskOffering21VO implements ServiceOffering { - @Column(name="cpu") - private int cpu; - - @Column(name="speed") - private int speed; - - @Column(name="ram_size") - private int ramSize; - - @Column(name="nw_rate") - private Integer rateMbps; - - @Column(name="mc_rate") - private Integer multicastRateMbps; - - @Column(name="ha_enabled") - private boolean offerHA; - - @Column(name="host_tag") - private String hostTag; - - protected ServiceOffering21VO() { - super(); - } - - public ServiceOffering21VO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, String displayText, boolean useLocalStorage, boolean recreatable, String tags) { - super(name, displayText, false, tags, recreatable, useLocalStorage); - this.cpu = cpu; - this.ramSize = ramSize; - this.speed = speed; - this.rateMbps = rateMbps; - this.multicastRateMbps = multicastRateMbps; - this.offerHA = offerHA; - } - - public ServiceOffering21VO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, String displayText, boolean useLocalStorage, boolean recreatable, String tags, String hostTag) { - this(name, cpu, ramSize, speed, rateMbps, multicastRateMbps, offerHA, displayText, useLocalStorage, recreatable, tags); - this.hostTag = hostTag; - } - - - @Override - public boolean getOfferHA() { - return offerHA; - } - - @Override - public boolean getLimitCpuUse() { - return false; - } - - public void setOfferHA(boolean offerHA) { - this.offerHA = offerHA; - } - - @Override - @Transient - public String[] getTagsArray() { - String tags = getTags(); - if (tags == null || tags.length() == 0) { - return new String[0]; - } - - return tags.split(","); - } - - @Override - public int getCpu() { - return cpu; - } - - public void setCpu(int cpu) { - this.cpu = cpu; - } - - public void setSpeed(int speed) { - this.speed = speed; - } - - public void setRamSize(int ramSize) { - this.ramSize = ramSize; - } - - @Override - public int getSpeed() { - return speed; - } - - @Override - public int getRamSize() { - return ramSize; - } - - public void setRateMbps(Integer rateMbps) { - this.rateMbps = rateMbps; - } - - @Override - public Integer getRateMbps() { - return rateMbps; - } - - public void setMulticastRateMbps(Integer multicastRateMbps) { - this.multicastRateMbps = multicastRateMbps; - } - - @Override - public Integer getMulticastRateMbps() { - return multicastRateMbps; - } - - public String gethypervisorType() { - return null; - } - - public void setHostTag(String hostTag) { - this.hostTag = hostTag; - } - - public String getHostTag() { - return hostTag; - } - - @Override - public boolean getDefaultUse() { - return false; - } - - @Override - public String getSystemVmType() { - return null; - } - - @Override - public String getUuid() { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean getVolatileVm() { - return false; - } - - -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/network/LBHealthCheckPolicyVO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/LBHealthCheckPolicyVO.java b/server/src/com/cloud/network/LBHealthCheckPolicyVO.java deleted file mode 100644 index ed03a2b..0000000 --- a/server/src/com/cloud/network/LBHealthCheckPolicyVO.java +++ /dev/null @@ -1,157 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.network; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -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.PrimaryKeyJoinColumn; -import javax.persistence.Table; - -import com.cloud.network.rules.HealthCheckPolicy; -import org.apache.cloudstack.api.InternalIdentity; - -@Entity -@Table(name = ("load_balancer_healthcheck_policies")) -@PrimaryKeyJoinColumn(name = "load_balancer_id", referencedColumnName = "id") -public class LBHealthCheckPolicyVO implements HealthCheckPolicy { - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "id") - private long id; - - @Column(name = "load_balancer_id") - private long loadBalancerId; - - @Column(name = "pingpath") - private String pingPath; - - @Column(name = "description") - private String description; - - @Column(name = "uuid") - private String uuid; - - @Column(name = "response_time") - private int responseTime; - - @Column(name = "healthcheck_interval") - private int healthcheckInterval; - - @Column(name = "healthcheck_thresshold") - private int healthcheckThresshold; - - @Column(name = "unhealth_thresshold") - private int unhealthThresshold; - - @Column(name = "revoke") - private boolean revoke = false; - - protected LBHealthCheckPolicyVO() { - this.uuid = UUID.randomUUID().toString(); - } - - public LBHealthCheckPolicyVO(long loadBalancerId, String pingPath, String description, int responseTime, - int healthcheckInterval, int healthcheckThresshold, int unhealthThresshold) { - this.loadBalancerId = loadBalancerId; - - if (pingPath == null || pingPath.isEmpty()) - this.pingPath = "/"; - else - this.pingPath = pingPath; - - if (responseTime == 0) - this.responseTime = 2; - else - this.responseTime = responseTime; - - if (healthcheckInterval == 0) - this.healthcheckInterval = 5; - else - this.healthcheckInterval = healthcheckInterval; - - if (healthcheckThresshold == 0) - this.healthcheckThresshold = 2; - else - this.healthcheckThresshold = healthcheckThresshold; - - if (unhealthThresshold == 0) - this.unhealthThresshold = 1; - else - this.unhealthThresshold = unhealthThresshold; - this.uuid = UUID.randomUUID().toString(); - - } - - public int getResponseTime() { - return responseTime; - } - - public int getHealthcheckInterval() { - return healthcheckInterval; - } - - public int getHealthcheckThresshold() { - return healthcheckThresshold; - } - - public int getUnhealthThresshold() { - return unhealthThresshold; - } - - public long getId() { - return id; - } - - public long getLoadBalancerId() { - return loadBalancerId; - } - - public String getpingpath() { - return pingPath; - } - - public String getDescription() { - return description; - } - - public boolean isRevoke() { - return revoke; - } - - public void setRevoke(boolean revoke) { - this.revoke = revoke; - } - - @Override - public String getUuid() { - return this.uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/network/UserIpv6Address.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/UserIpv6Address.java b/server/src/com/cloud/network/UserIpv6Address.java deleted file mode 100644 index 4c33d45..0000000 --- a/server/src/com/cloud/network/UserIpv6Address.java +++ /dev/null @@ -1,52 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.network; - -import org.apache.cloudstack.acl.ControlledEntity; -import org.apache.cloudstack.api.Identity; -import org.apache.cloudstack.api.InternalIdentity; - -/** - * @author Sheng Yang - * - */ -public interface UserIpv6Address extends ControlledEntity, Identity, InternalIdentity { - enum State { - Allocating, // The IP Address is being propagated to other network elements and is not ready for use yet. - Allocated, // The IP address is in used. - Releasing, // The IP address is being released for other network elements and is not ready for allocation. - Free // The IP address is ready to be allocated. - } - - long getDataCenterId(); - - String getAddress(); - - long getVlanId(); - - State getState(); - - Long getNetworkId(); - - Long getSourceNetworkId(); - - Long getPhysicalNetworkId(); - - void setState(UserIpv6Address.State state); - - String getMacAddress(); -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/network/UserIpv6AddressVO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/UserIpv6AddressVO.java b/server/src/com/cloud/network/UserIpv6AddressVO.java deleted file mode 100644 index 70eb12d..0000000 --- a/server/src/com/cloud/network/UserIpv6AddressVO.java +++ /dev/null @@ -1,188 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.network; - -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.Transient; - -import com.cloud.utils.db.GenericDao; - -@Entity -@Table(name=("user_ipv6_address")) -public class UserIpv6AddressVO implements UserIpv6Address { - @Id - @GeneratedValue(strategy=GenerationType.IDENTITY) - @Column(name="id") - long id; - - @Column(name="ip_address") - @Enumerated(value=EnumType.STRING) - private String address = null; - - @Column(name="data_center_id", updatable=false) - private long dataCenterId; - - @Column(name="vlan_id") - private long vlanId; - - @Column(name="state") - private State state; - - @Column(name="mac_address") - private String macAddress; - - @Column(name="source_network_id") - private Long sourceNetworkId; - - @Column(name="network_id") - private Long networkId; - - @Column(name="uuid") - private String uuid; - - @Column(name="physical_network_id") - private Long physicalNetworkId; - - @Column(name="account_id") - private Long accountId = null; - - @Column(name="domain_id") - private Long domainId = null; - - @Column(name = GenericDao.CREATED_COLUMN) - Date created; - - protected UserIpv6AddressVO() { - this.uuid = UUID.randomUUID().toString(); - } - - public UserIpv6AddressVO(String address, long dataCenterId, String macAddress, long vlanDbId) { - this.address = address; - this.dataCenterId = dataCenterId; - this.vlanId = vlanDbId; - this.state = State.Free; - this.setMacAddress(macAddress); - this.uuid = UUID.randomUUID().toString(); - } - - - @Override - public long getAccountId() { - return accountId; - } - - @Override - public long getDomainId() { - return domainId; - } - - @Override - public String getUuid() { - return uuid; - } - - @Override - public long getId() { - return id; - } - - @Override - public long getDataCenterId() { - return dataCenterId; - } - - @Override - public String getAddress() { - return address; - } - - @Override - public long getVlanId() { - return vlanId; - } - - @Override - public State getState() { - return state; - } - - @Override - public Long getNetworkId() { - return networkId; - } - - @Override - public Long getSourceNetworkId() { - return sourceNetworkId; - } - - @Override - public Long getPhysicalNetworkId() { - return physicalNetworkId; - } - - @Override - public void setState(State state) { - this.state = state; - } - - public String getMacAddress() { - return macAddress; - } - - public void setMacAddress(String macAddress) { - this.macAddress = macAddress; - } - - public void setSourceNetworkId(Long sourceNetworkId) { - this.sourceNetworkId = sourceNetworkId; - } - - public void setNetworkId(Long networkId) { - this.networkId = networkId; - } - - public void setPhysicalNetworkId(Long physicalNetworkId) { - this.physicalNetworkId = physicalNetworkId; - } - - public void setDomainId(Long domainId) { - this.domainId = domainId; - } - - public void setAccountId(Long accountId) { - this.accountId = accountId; - } - - public Date getCreated() { - return created; - } - - public void setCreated(Date created) { - this.created = created; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/network/as/AutoScalePolicyConditionMapVO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/as/AutoScalePolicyConditionMapVO.java b/server/src/com/cloud/network/as/AutoScalePolicyConditionMapVO.java deleted file mode 100644 index 7d87b27..0000000 --- a/server/src/com/cloud/network/as/AutoScalePolicyConditionMapVO.java +++ /dev/null @@ -1,61 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.network.as; - -import org.apache.cloudstack.api.InternalIdentity; - -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=("autoscale_policy_condition_map")) -public class AutoScalePolicyConditionMapVO implements InternalIdentity { - - @Id - @GeneratedValue(strategy=GenerationType.IDENTITY) - @Column(name="id") - private long id; - - @Column(name="policy_id") - private long policyId; - - @Column(name="condition_id") - private long conditionId; - - public AutoScalePolicyConditionMapVO() { } - - public AutoScalePolicyConditionMapVO(long policyId, long conditionId) { - this.policyId = policyId; - this.conditionId = conditionId; - } - - public long getId() { - return id; - } - - public long getPolicyId() { - return policyId; - } - - public long getConditionId() { - return conditionId; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/network/as/AutoScalePolicyVO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/as/AutoScalePolicyVO.java b/server/src/com/cloud/network/as/AutoScalePolicyVO.java deleted file mode 100644 index f8fbcb4..0000000 --- a/server/src/com/cloud/network/as/AutoScalePolicyVO.java +++ /dev/null @@ -1,134 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.network.as; - -import java.util.Date; -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.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; - -import com.cloud.utils.db.GenericDao; -import org.apache.cloudstack.api.InternalIdentity; - -@Entity -@Table(name = "autoscale_policies") -@Inheritance(strategy = InheritanceType.JOINED) -public class AutoScalePolicyVO implements AutoScalePolicy, InternalIdentity { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "id") - long id; - - @Column(name = "uuid") - String uuid; - - @Column(name = "domain_id") - private long domainId; - - @Column(name = "account_id") - private long accountId; - - @Column(name = "duration") - private int duration; - - @Column(name = "quiet_time", updatable = true, nullable = false) - private int quietTime; - - @Column(name = "action", updatable = false, nullable = false) - private String action; - - @Column(name = GenericDao.REMOVED_COLUMN) - protected Date removed; - - @Column(name = GenericDao.CREATED_COLUMN) - protected Date created; - - public AutoScalePolicyVO() { - } - - public AutoScalePolicyVO(long domainId, long accountId, int duration, int quietTime, String action) { - this.uuid = UUID.randomUUID().toString(); - this.domainId = domainId; - this.accountId = accountId; - this.duration = duration; - this.quietTime = quietTime; - this.action = action; - } - - @Override - public String toString() { - return new StringBuilder("AutoScalePolicy[").append("id-").append(id).append("]").toString(); - } - - @Override - public long getId() { - return id; - } - - public String getUuid() { - return uuid; - } - - @Override - public long getDomainId() { - return domainId; - } - - @Override - public long getAccountId() { - return accountId; - } - - @Override - public int getDuration() { - return duration; - } - - @Override - public int getQuietTime() { - return quietTime; - } - - @Override - public String getAction() { - return action; - } - - public Date getRemoved() { - return removed; - } - - public Date getCreated() { - return created; - } - - public void setDuration(Integer duration) { - this.duration = duration; - } - - public void setQuietTime(Integer quietTime) { - this.quietTime = quietTime; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/network/as/AutoScaleVmGroupPolicyMapVO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/as/AutoScaleVmGroupPolicyMapVO.java b/server/src/com/cloud/network/as/AutoScaleVmGroupPolicyMapVO.java deleted file mode 100644 index 7e1c38a..0000000 --- a/server/src/com/cloud/network/as/AutoScaleVmGroupPolicyMapVO.java +++ /dev/null @@ -1,64 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.network.as; - -import org.apache.cloudstack.api.InternalIdentity; - -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=("autoscale_vmgroup_policy_map")) -public class AutoScaleVmGroupPolicyMapVO implements InternalIdentity { - @Id - @GeneratedValue(strategy=GenerationType.IDENTITY) - @Column(name="id") - private long id; - - @Column(name="vmgroup_id") - private long vmGroupId; - - @Column(name="policy_id") - private long policyId; - - public AutoScaleVmGroupPolicyMapVO() { } - - public AutoScaleVmGroupPolicyMapVO(long vmGroupId, long policyId) { - this.vmGroupId = vmGroupId; - this.policyId = policyId; - } - - public AutoScaleVmGroupPolicyMapVO(long vmgroupId, long policyId, boolean revoke) { - this(vmgroupId, policyId); - } - - public long getId() { - return id; - } - - public long getVmGroupId() { - return vmGroupId; - } - - public long getPolicyId() { - return policyId; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/network/as/AutoScaleVmGroupVO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/as/AutoScaleVmGroupVO.java b/server/src/com/cloud/network/as/AutoScaleVmGroupVO.java deleted file mode 100644 index d1d85f9..0000000 --- a/server/src/com/cloud/network/as/AutoScaleVmGroupVO.java +++ /dev/null @@ -1,191 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.network.as; - -import java.util.Date; -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.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; - -import com.cloud.utils.db.GenericDao; -import org.apache.cloudstack.api.InternalIdentity; - -@Entity -@Table(name = "autoscale_vmgroups") -@Inheritance(strategy = InheritanceType.JOINED) -public class AutoScaleVmGroupVO implements AutoScaleVmGroup, InternalIdentity { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "id") - long id; - - @Column(name = "uuid") - String uuid; - - @Column(name = "zone_id", updatable = false) - private long zoneId; - - @Column(name = "domain_id", updatable = false) - private long domainId; - - @Column(name = "account_id") - private long accountId; - - @Column(name = "load_balancer_id") - private Long loadBalancerId; - - @Column(name = "min_members", updatable = true) - private int minMembers; - - @Column(name = "max_members", updatable = true) - private int maxMembers; - - @Column(name = "member_port") - private int memberPort; - - @Column(name = "interval") - private int interval; - - @Column(name = "profile_id") - private long profileId; - - @Column(name = GenericDao.REMOVED_COLUMN) - protected Date removed; - - @Column(name = GenericDao.CREATED_COLUMN) - protected Date created; - - @Column(name = "state") - private String state; - - public AutoScaleVmGroupVO() { - } - - public AutoScaleVmGroupVO(long lbRuleId, long zoneId, long domainId, long accountId, int minMembers, int maxMembers, int memberPort, int interval, long profileId, String state) { - this.uuid = UUID.randomUUID().toString(); - this.loadBalancerId = lbRuleId; - this.minMembers = minMembers; - this.maxMembers = maxMembers; - this.memberPort = memberPort; - this.profileId = profileId; - this.accountId = accountId; - this.domainId = domainId; - this.zoneId = zoneId; - this.state = state; - this.interval = interval; - } - - @Override - public String toString() { - return new StringBuilder("AutoScaleVmGroupVO[").append("id").append("]").toString(); - } - - @Override - public long getId() { - return id; - } - - public long getZoneId() { - return zoneId; - } - - @Override - public long getDomainId() { - return domainId; - } - - @Override - public long getAccountId() { - return accountId; - } - - @Override - public Long getLoadBalancerId() { - return loadBalancerId; - } - - @Override - public int getMinMembers() { - return minMembers; - } - - @Override - public int getMaxMembers() { - return maxMembers; - } - - @Override - public int getMemberPort() { - return memberPort; - } - - @Override - public int getInterval() { - return interval; - } - - @Override - public long getProfileId() { - return profileId; - } - - public Date getRemoved() { - return removed; - } - - public Date getCreated() { - return created; - } - - @Override - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public void setMinMembers(int minMembers) { - this.minMembers = minMembers; - } - - public void setMaxMembers(int maxMembers) { - this.maxMembers = maxMembers; - } - - public void setInterval(Integer interval) { - this.interval = interval; - } - - public void setLoadBalancerId(Long loadBalancerId) { - this.loadBalancerId = loadBalancerId; - } - - @Override - public String getUuid() { - return uuid; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/network/as/AutoScaleVmProfileVO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/as/AutoScaleVmProfileVO.java b/server/src/com/cloud/network/as/AutoScaleVmProfileVO.java deleted file mode 100644 index 011be2b..0000000 --- a/server/src/com/cloud/network/as/AutoScaleVmProfileVO.java +++ /dev/null @@ -1,218 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.network.as; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -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.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; - -import org.apache.cloudstack.api.Identity; -import com.cloud.utils.Pair; -import com.cloud.utils.db.GenericDao; -import com.cloud.utils.net.NetUtils; -import org.apache.cloudstack.api.InternalIdentity; - -@Entity -@Table(name = "autoscale_vmprofiles") -@Inheritance(strategy = InheritanceType.JOINED) -public class AutoScaleVmProfileVO implements AutoScaleVmProfile, Identity, InternalIdentity { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "id") - protected long id; - - @Column(name = "uuid") - protected String uuid; - - @Column(name = "zone_id", updatable = true, nullable = false) - protected Long zoneId; - - @Column(name = "domain_id", updatable = true) - private long domainId; - - @Column(name = "account_id") - private long accountId; - - @Column(name = "autoscale_user_id") - private long autoscaleUserId; - - @Column(name = "service_offering_id", updatable = true, nullable = false) - private Long serviceOfferingId; - - @Column(name = "template_id", updatable = true, nullable = false, length = 17) - private Long templateId; - - @Column(name = "other_deploy_params", updatable = true, length = 1024) - private String otherDeployParams; - - @Column(name = "destroy_vm_grace_period", updatable = true) - private Integer destroyVmGraceperiod = NetUtils.DEFAULT_AUTOSCALE_VM_DESTROY_TIME; - - @Column(name = "counter_params", updatable = true) - private String counterParams; - - @Column(name = GenericDao.REMOVED_COLUMN) - protected Date removed; - - @Column(name = GenericDao.CREATED_COLUMN) - protected Date created; - - public AutoScaleVmProfileVO() { - } - - public AutoScaleVmProfileVO(long zoneId, long domainId, long accountId, long serviceOfferingId, long templateId, String otherDeployParams, Map counterParamList, Integer destroyVmGraceperiod, - long autoscaleUserId) { - this.uuid = UUID.randomUUID().toString(); - this.zoneId = zoneId; - this.domainId = domainId; - this.accountId = accountId; - this.serviceOfferingId = serviceOfferingId; - this.templateId = templateId; - this.otherDeployParams = otherDeployParams; - this.autoscaleUserId = autoscaleUserId; - if (destroyVmGraceperiod != null) { - this.destroyVmGraceperiod = destroyVmGraceperiod; - } - setCounterParamsForUpdate(counterParamList); - } - - @Override - public String toString() { - return new StringBuilder("AutoScaleVMProfileVO[").append("id").append(id).append("-").append("templateId").append("-").append(templateId).append("]").toString(); - } - - @Override - public Long getTemplateId() { - return templateId; - } - - public void setTemplateId(Long templateId) { - this.templateId = templateId; - } - - @Override - public Long getServiceOfferingId() { - return serviceOfferingId; - } - - @Override - public String getOtherDeployParams() { - return otherDeployParams; - } - - public void setOtherDeployParams(String otherDeployParams) { - this.otherDeployParams = otherDeployParams; - } - - @Override - public List> getCounterParams() { - List> paramsList = new ArrayList>(); - if (counterParams != null) { - String[] params = counterParams.split("[=&]"); - for (int i = 0; i < (params.length - 1); i = i + 2) { - paramsList.add(new Pair(params[i], params[i + 1])); - } - } - return paramsList; - } - - public void setCounterParams(String counterParam) { - this.counterParams = counterParam; - } - - public void setCounterParamsForUpdate(Map counterParamList) { - StringBuilder sb = new StringBuilder(""); - boolean isFirstParam = true; - if (counterParamList != null) { - Iterator> iter = counterParamList.values().iterator(); - while (iter.hasNext()) { - HashMap paramKVpair = iter.next(); - if (!isFirstParam) { - sb.append("&"); - } - String paramName = paramKVpair.get("name"); - String paramValue = paramKVpair.get("value"); - sb.append(paramName + "=" + paramValue); - isFirstParam = false; - } - } - /* - * setCounterParams(String counterParam)'s String param is caught by UpdateBuilder and stored in an internal - * list. - * Which is used later to update the db. The variables in a VO object is not used to update the db. - * Hence calling the function which is intercepted. - */ - setCounterParams(sb.toString()); - } - - @Override - public String getUuid() { - return uuid; - } - - public void setAutoscaleUserId(long autoscaleUserId) { - this.autoscaleUserId = autoscaleUserId; - } - - @Override - public Long getZoneId() { - return zoneId; - } - - @Override - public long getAccountId() { - return accountId; - } - - @Override - public long getDomainId() { - return domainId; - } - - @Override - public long getId() { - return id; - } - - @Override - public Integer getDestroyVmGraceperiod() { - return destroyVmGraceperiod; - } - - public void setDestroyVmGraceperiod(Integer destroyVmGraceperiod) { - this.destroyVmGraceperiod = destroyVmGraceperiod; - } - - @Override - public long getAutoScaleUserId() { - return autoscaleUserId; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/network/as/ConditionVO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/as/ConditionVO.java b/server/src/com/cloud/network/as/ConditionVO.java deleted file mode 100644 index bbae72f..0000000 --- a/server/src/com/cloud/network/as/ConditionVO.java +++ /dev/null @@ -1,129 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -package com.cloud.network.as; - -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 org.apache.cloudstack.api.Identity; -import com.cloud.utils.db.GenericDao; -import org.apache.cloudstack.api.InternalIdentity; - -@Entity -@Table(name = "conditions") -public class ConditionVO implements Condition, Identity, InternalIdentity { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "id") - private long id; - - @Column(name = "counter_id") - private long counterid; - - @Column(name = "threshold") - private long threshold; - - @Column(name = "relational_operator") - @Enumerated(value = EnumType.STRING) - private Operator relationalOperator; - - @Column(name = "domain_id") - protected long domainId; - - @Column(name = "account_id") - protected long accountId; - - @Column(name = "uuid") - private String uuid; - - @Column(name = GenericDao.REMOVED_COLUMN) - Date removed; - - @Column(name = GenericDao.CREATED_COLUMN) - Date created; - - public ConditionVO() { - } - - public ConditionVO(long counterid, long threshold, long accountId, long domainId, Operator relationalOperator) { - this.counterid = counterid; - this.threshold = threshold; - this.relationalOperator = relationalOperator; - this.accountId = accountId; - this.domainId = domainId; - this.uuid = UUID.randomUUID().toString(); - } - - public Date getCreated() { - return created; - } - - @Override - public long getId() { - return id; - } - - @Override - public String toString() { - return new StringBuilder("Condition[").append("id-").append(id).append("]").toString(); - } - - @Override - public long getCounterid() { - return counterid; - } - - @Override - public long getThreshold() { - return threshold; - } - - @Override - public Operator getRelationalOperator() { - return relationalOperator; - } - - @Override - public long getAccountId() { - return accountId; - } - - @Override - public long getDomainId() { - return domainId; - } - - @Override - public String getUuid() { - return this.uuid; - } - - public Date getRemoved() { - return removed; - } -}