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 C0427105C3 for ; Wed, 8 May 2013 11:59:46 +0000 (UTC) Received: (qmail 9664 invoked by uid 500); 8 May 2013 11:59:42 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 8852 invoked by uid 500); 8 May 2013 11:59:36 -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 8105 invoked by uid 99); 8 May 2013 11:59:31 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 May 2013 11:59:31 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id AF2AE889960; Wed, 8 May 2013 11:59:30 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tsp@apache.org To: commits@cloudstack.apache.org Date: Wed, 08 May 2013 11:59:41 -0000 Message-Id: <8a78cb4bc18b4d0f9d2ed699f51434ad@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [12/90] [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/572e71e5/server/src/com/cloud/network/as/CounterVO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/as/CounterVO.java b/server/src/com/cloud/network/as/CounterVO.java deleted file mode 100644 index b7b03f7..0000000 --- a/server/src/com/cloud/network/as/CounterVO.java +++ /dev/null @@ -1,111 +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 = "counter") -public class CounterVO implements Counter, Identity, InternalIdentity { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "id") - private long id; - - @Column(name = "source") - @Enumerated(value = EnumType.STRING) - private Source source; - - @Column(name = "name") - private String name; - - @Column(name = "value") - private String value; - - @Column(name = "uuid") - private String uuid; - - @Column(name = GenericDao.REMOVED_COLUMN) - Date removed; - - @Column(name = GenericDao.CREATED_COLUMN) - Date created; - - public CounterVO() { - } - - public CounterVO(Source source, String name, String value) { - this.source = source; - this.name = name; - this.value = value; - this.uuid = UUID.randomUUID().toString(); - } - - @Override - public String toString() { - return new StringBuilder("Counter[").append("id-").append(id).append("]").toString(); - } - - @Override - public String getName() { - return name; - } - - @Override - public String getValue() { - return value; - } - - @Override - public Source getSource() { - return source; - } - - @Override - public long getId() { - return id; - } - - @Override - public String getUuid() { - return this.uuid; - } - - public Date getRemoved() { - return removed; - } - - public Date getCreated() { - return created; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/as/dao/AutoScalePolicyConditionMapDao.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/as/dao/AutoScalePolicyConditionMapDao.java b/server/src/com/cloud/network/as/dao/AutoScalePolicyConditionMapDao.java deleted file mode 100644 index 3025198..0000000 --- a/server/src/com/cloud/network/as/dao/AutoScalePolicyConditionMapDao.java +++ /dev/null @@ -1,28 +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.dao; - -import java.util.List; - -import com.cloud.network.as.AutoScalePolicyConditionMapVO; -import com.cloud.utils.db.GenericDao; - -public interface AutoScalePolicyConditionMapDao extends GenericDao { - List listByAll(Long policyId, Long conditionId); - public boolean isConditionInUse(Long conditionId); - boolean removeByAutoScalePolicyId(long id); -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/as/dao/AutoScalePolicyConditionMapDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/as/dao/AutoScalePolicyConditionMapDaoImpl.java b/server/src/com/cloud/network/as/dao/AutoScalePolicyConditionMapDaoImpl.java deleted file mode 100644 index 00fee3d..0000000 --- a/server/src/com/cloud/network/as/dao/AutoScalePolicyConditionMapDaoImpl.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.dao; - -import java.util.List; - -import javax.ejb.Local; - -import org.springframework.stereotype.Component; - -import com.cloud.network.as.AutoScalePolicyConditionMapVO; -import com.cloud.utils.db.GenericDaoBase; -import com.cloud.utils.db.SearchCriteria; - -@Component -@Local(value={AutoScalePolicyConditionMapDao.class}) -public class AutoScalePolicyConditionMapDaoImpl extends GenericDaoBase implements AutoScalePolicyConditionMapDao { - - private SearchCriteria getSearchCriteria(Long policyId, Long conditionId) - { - SearchCriteria sc = createSearchCriteria(); - - if(policyId != null) - sc.addAnd("policyId", SearchCriteria.Op.EQ, policyId); - - if(conditionId != null) - sc.addAnd("conditionId", SearchCriteria.Op.EQ, conditionId); - - return sc; - } - - @Override - public List listByAll(Long policyId, Long conditionId) { - return listBy(getSearchCriteria(policyId, conditionId)); - } - - public boolean isConditionInUse(Long conditionId) { - return findOneBy(getSearchCriteria(null, conditionId)) != null; - } - - @Override - public boolean removeByAutoScalePolicyId(long policyId) { - SearchCriteria sc = createSearchCriteria(); - sc.addAnd("policyId", SearchCriteria.Op.EQ, policyId); - return expunge(sc) > 0; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/as/dao/AutoScalePolicyDao.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/as/dao/AutoScalePolicyDao.java b/server/src/com/cloud/network/as/dao/AutoScalePolicyDao.java deleted file mode 100644 index 0cc2d27..0000000 --- a/server/src/com/cloud/network/as/dao/AutoScalePolicyDao.java +++ /dev/null @@ -1,24 +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.dao; - -import com.cloud.network.as.AutoScalePolicyVO; -import com.cloud.utils.db.GenericDao; - -public interface AutoScalePolicyDao extends GenericDao { - int removeByAccountId(long accountId); -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/as/dao/AutoScalePolicyDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/as/dao/AutoScalePolicyDaoImpl.java b/server/src/com/cloud/network/as/dao/AutoScalePolicyDaoImpl.java deleted file mode 100644 index 796a9c3..0000000 --- a/server/src/com/cloud/network/as/dao/AutoScalePolicyDaoImpl.java +++ /dev/null @@ -1,38 +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.dao; - -import javax.ejb.Local; - -import org.springframework.stereotype.Component; - -import com.cloud.network.as.AutoScalePolicyVO; -import com.cloud.utils.db.GenericDaoBase; -import com.cloud.utils.db.SearchCriteria; - -@Component -@Local(value = { AutoScalePolicyDao.class }) -public class AutoScalePolicyDaoImpl extends GenericDaoBase implements AutoScalePolicyDao { - - public int removeByAccountId(long accountId) { - SearchCriteria sc = createSearchCriteria(); - - sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId); - - return remove(sc); - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/as/dao/AutoScaleVmGroupDao.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/as/dao/AutoScaleVmGroupDao.java b/server/src/com/cloud/network/as/dao/AutoScaleVmGroupDao.java deleted file mode 100644 index 3fc8a5b..0000000 --- a/server/src/com/cloud/network/as/dao/AutoScaleVmGroupDao.java +++ /dev/null @@ -1,28 +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.dao; - -import java.util.List; - -import com.cloud.network.as.AutoScaleVmGroupVO; -import com.cloud.utils.db.GenericDao; - -public interface AutoScaleVmGroupDao extends GenericDao { - List listByAll(Long loadBalancerId, Long profileId); - boolean isProfileInUse(long profileId); - boolean isAutoScaleLoadBalancer(Long loadBalancerId); -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/as/dao/AutoScaleVmGroupDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/as/dao/AutoScaleVmGroupDaoImpl.java b/server/src/com/cloud/network/as/dao/AutoScaleVmGroupDaoImpl.java deleted file mode 100644 index 4ddd572..0000000 --- a/server/src/com/cloud/network/as/dao/AutoScaleVmGroupDaoImpl.java +++ /dev/null @@ -1,65 +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.dao; - -import java.util.List; - -import javax.ejb.Local; - -import org.springframework.stereotype.Component; - -import com.cloud.network.as.AutoScaleVmGroupVO; -import com.cloud.utils.db.GenericDaoBase; -import com.cloud.utils.db.GenericSearchBuilder; -import com.cloud.utils.db.SearchCriteria; -import com.cloud.utils.db.SearchCriteria.Func; - -@Component -@Local(value = { AutoScaleVmGroupDao.class }) -public class AutoScaleVmGroupDaoImpl extends GenericDaoBase implements AutoScaleVmGroupDao { - - @Override - public List listByAll(Long loadBalancerId, Long profileId) { - SearchCriteria sc = createSearchCriteria(); - - if(loadBalancerId != null) - sc.addAnd("loadBalancerId", SearchCriteria.Op.EQ, loadBalancerId); - - if(profileId != null) - sc.addAnd("profileId", SearchCriteria.Op.EQ, profileId); - - return listBy(sc); - } - - @Override - public boolean isProfileInUse(long profileId) { - SearchCriteria sc = createSearchCriteria(); - sc.addAnd("profileId", SearchCriteria.Op.EQ, profileId); - return findOneBy(sc) != null; - } - - @Override - public boolean isAutoScaleLoadBalancer(Long loadBalancerId) { - GenericSearchBuilder CountByAccount = createSearchBuilder(Long.class); - CountByAccount.select(null, Func.COUNT, null); - CountByAccount.and("loadBalancerId", CountByAccount.entity().getLoadBalancerId(), SearchCriteria.Op.EQ); - - SearchCriteria sc = CountByAccount.create(); - sc.setParameters("loadBalancerId", loadBalancerId); - return customSearch(sc, null).get(0) > 0; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/as/dao/AutoScaleVmGroupPolicyMapDao.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/as/dao/AutoScaleVmGroupPolicyMapDao.java b/server/src/com/cloud/network/as/dao/AutoScaleVmGroupPolicyMapDao.java deleted file mode 100644 index 41d91f7..0000000 --- a/server/src/com/cloud/network/as/dao/AutoScaleVmGroupPolicyMapDao.java +++ /dev/null @@ -1,30 +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.dao; - -import java.util.List; - -import com.cloud.network.as.AutoScaleVmGroupPolicyMapVO; -import com.cloud.utils.db.GenericDao; - -public interface AutoScaleVmGroupPolicyMapDao extends GenericDao { - boolean removeByGroupId(long vmGroupId); - boolean removeByGroupAndPolicies(long vmGroupId, List bakupPolicyIds); - List listByVmGroupId(long vmGroupId); - List listByPolicyId(long policyId); - public boolean isAutoScalePolicyInUse(long policyId); -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/as/dao/AutoScaleVmGroupPolicyMapDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/as/dao/AutoScaleVmGroupPolicyMapDaoImpl.java b/server/src/com/cloud/network/as/dao/AutoScaleVmGroupPolicyMapDaoImpl.java deleted file mode 100644 index ffb3dbc..0000000 --- a/server/src/com/cloud/network/as/dao/AutoScaleVmGroupPolicyMapDaoImpl.java +++ /dev/null @@ -1,77 +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.dao; - -import java.util.List; - -import javax.ejb.Local; - -import org.springframework.stereotype.Component; - -import com.cloud.network.as.AutoScaleVmGroupPolicyMapVO; -import com.cloud.utils.db.GenericDaoBase; -import com.cloud.utils.db.SearchBuilder; -import com.cloud.utils.db.SearchCriteria; -import com.cloud.utils.db.SearchCriteria.Op; - -@Component -@Local(value={AutoScaleVmGroupPolicyMapDao.class}) -public class AutoScaleVmGroupPolicyMapDaoImpl extends GenericDaoBase implements AutoScaleVmGroupPolicyMapDao { - - @Override - public boolean removeByGroupId(long vmGroupId) { - SearchCriteria sc = createSearchCriteria(); - sc.addAnd("vmGroupId", SearchCriteria.Op.EQ, vmGroupId); - - return expunge(sc) > 0; - } - - @Override - public boolean removeByGroupAndPolicies(long vmGroupId, List policyIds) { - SearchBuilder policySearch = createSearchBuilder(); - policySearch.and("vmGroupId", policySearch.entity().getVmGroupId(), Op.EQ); - policySearch.and("policyIds", policySearch.entity().getPolicyId(), Op.IN); - policySearch.done(); - SearchCriteria sc = policySearch.create(); - sc.setParameters("vmGroupId", vmGroupId); - sc.setParameters("policyIds", policyIds); - return expunge(sc) > 0; - } - - @Override - public List listByVmGroupId(long vmGroupId) { - SearchCriteria sc = createSearchCriteria(); - sc.addAnd("vmGroupId", SearchCriteria.Op.EQ, vmGroupId); - return listBy(sc); - } - - @Override - public List listByPolicyId(long policyId) { - SearchCriteria sc = createSearchCriteria(); - sc.addAnd("policyId", SearchCriteria.Op.EQ, policyId); - - return listBy(sc); - } - - @Override - public boolean isAutoScalePolicyInUse(long policyId) { - SearchCriteria sc = createSearchCriteria(); - sc.addAnd("policyId", SearchCriteria.Op.EQ, policyId); - return findOneBy(sc) != null; - } - -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/as/dao/AutoScaleVmProfileDao.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/as/dao/AutoScaleVmProfileDao.java b/server/src/com/cloud/network/as/dao/AutoScaleVmProfileDao.java deleted file mode 100644 index 0855bf7..0000000 --- a/server/src/com/cloud/network/as/dao/AutoScaleVmProfileDao.java +++ /dev/null @@ -1,25 +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.dao; - -import com.cloud.network.as.AutoScaleVmProfileVO; -import com.cloud.utils.db.GenericDao; - -public interface AutoScaleVmProfileDao extends GenericDao { - - int removeByAccountId(long accountId); -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/as/dao/AutoScaleVmProfileDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/as/dao/AutoScaleVmProfileDaoImpl.java b/server/src/com/cloud/network/as/dao/AutoScaleVmProfileDaoImpl.java deleted file mode 100644 index 5d08491..0000000 --- a/server/src/com/cloud/network/as/dao/AutoScaleVmProfileDaoImpl.java +++ /dev/null @@ -1,38 +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.dao; - -import javax.ejb.Local; - -import org.springframework.stereotype.Component; - -import com.cloud.network.as.AutoScaleVmProfileVO; -import com.cloud.utils.db.GenericDaoBase; -import com.cloud.utils.db.SearchCriteria; - -@Component -@Local(value = { AutoScaleVmProfileDao.class }) -public class AutoScaleVmProfileDaoImpl extends GenericDaoBase implements AutoScaleVmProfileDao { - - @Override - public int removeByAccountId(long accountId) { - SearchCriteria sc = createSearchCriteria(); - sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId); - - return remove(sc); - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/as/dao/ConditionDao.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/as/dao/ConditionDao.java b/server/src/com/cloud/network/as/dao/ConditionDao.java deleted file mode 100644 index 128920d..0000000 --- a/server/src/com/cloud/network/as/dao/ConditionDao.java +++ /dev/null @@ -1,28 +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.dao; - -import com.cloud.network.as.ConditionVO; -import com.cloud.utils.db.GenericDao; - -public interface ConditionDao extends GenericDao { - - ConditionVO findByCounterId(long ctrId); - - int removeByAccountId(long accountId); -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/as/dao/ConditionDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/as/dao/ConditionDaoImpl.java b/server/src/com/cloud/network/as/dao/ConditionDaoImpl.java deleted file mode 100644 index 8235823..0000000 --- a/server/src/com/cloud/network/as/dao/ConditionDaoImpl.java +++ /dev/null @@ -1,56 +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.dao; - -import javax.ejb.Local; - -import org.springframework.stereotype.Component; - -import com.cloud.network.as.ConditionVO; -import com.cloud.utils.db.GenericDaoBase; -import com.cloud.utils.db.SearchBuilder; -import com.cloud.utils.db.SearchCriteria; -import com.cloud.utils.db.SearchCriteria.Op; - -@Component -@Local(value = ConditionDao.class) -public class ConditionDaoImpl extends GenericDaoBase implements ConditionDao { - final SearchBuilder AllFieldsSearch; - - protected ConditionDaoImpl() { - AllFieldsSearch = createSearchBuilder(); - AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), Op.EQ); - AllFieldsSearch.and("counterId", AllFieldsSearch.entity().getCounterid(), Op.EQ); - AllFieldsSearch.done(); - } - - @Override - public ConditionVO findByCounterId(long ctrId) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("counterId", ctrId); - return findOneBy(sc); - } - - public int removeByAccountId(long accountId) { - SearchCriteria sc = createSearchCriteria(); - - sc.addAnd("accountId", SearchCriteria.Op.EQ, accountId); - - return remove(sc); - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/as/dao/CounterDao.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/as/dao/CounterDao.java b/server/src/com/cloud/network/as/dao/CounterDao.java deleted file mode 100644 index 47b0d48..0000000 --- a/server/src/com/cloud/network/as/dao/CounterDao.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.network.as.dao; - -import java.util.List; - -import com.cloud.network.as.CounterVO; -import com.cloud.utils.db.Filter; -import com.cloud.utils.db.GenericDao; - -public interface CounterDao extends GenericDao { - public List listCounters(Long id, String name, String source, String keyword, Filter filter); - -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/as/dao/CounterDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/as/dao/CounterDaoImpl.java b/server/src/com/cloud/network/as/dao/CounterDaoImpl.java deleted file mode 100644 index 0abc3a0..0000000 --- a/server/src/com/cloud/network/as/dao/CounterDaoImpl.java +++ /dev/null @@ -1,70 +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.dao; - -import java.util.List; - -import javax.ejb.Local; - -import org.springframework.stereotype.Component; - -import com.cloud.network.as.CounterVO; -import com.cloud.utils.db.Filter; -import com.cloud.utils.db.GenericDaoBase; -import com.cloud.utils.db.SearchBuilder; -import com.cloud.utils.db.SearchCriteria; -import com.cloud.utils.db.SearchCriteria.Op; - -@Component -@Local(value = CounterDao.class) -public class CounterDaoImpl extends GenericDaoBase implements CounterDao { - final SearchBuilder AllFieldsSearch; - - protected CounterDaoImpl() { - AllFieldsSearch = createSearchBuilder(); - AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), Op.EQ); - AllFieldsSearch.and("name", AllFieldsSearch.entity().getName(), Op.LIKE); - AllFieldsSearch.and("source", AllFieldsSearch.entity().getSource(), Op.EQ); - AllFieldsSearch.done(); - } - - @Override - public List listCounters(Long id, String name, String source, String keyword, Filter filter) { - SearchCriteria sc = AllFieldsSearch.create(); - - if (keyword != null) { - SearchCriteria ssc = createSearchCriteria(); - ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%"); - sc.addAnd("name", SearchCriteria.Op.SC, ssc); - } - - if (name != null) { - sc.addAnd("name", SearchCriteria.Op.LIKE, "%" + name + "%"); - } - - if (id != null) { - sc.addAnd("id", SearchCriteria.Op.EQ, id); - } - - if (source != null) { - sc.addAnd("source", SearchCriteria.Op.EQ, source); - } - return listBy(sc, filter); - } - -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/ExternalFirewallDeviceDao.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/ExternalFirewallDeviceDao.java b/server/src/com/cloud/network/dao/ExternalFirewallDeviceDao.java deleted file mode 100644 index bb3ebef..0000000 --- a/server/src/com/cloud/network/dao/ExternalFirewallDeviceDao.java +++ /dev/null @@ -1,58 +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.dao; - -import java.util.List; - -import com.cloud.network.dao.ExternalFirewallDeviceVO.FirewallDeviceAllocationState; -import com.cloud.network.dao.ExternalFirewallDeviceVO.FirewallDeviceState; -import com.cloud.utils.db.GenericDao; - -public interface ExternalFirewallDeviceDao extends GenericDao { - - /** - * list all the firewall devices added in to this physical network? - * @param physicalNetworkId physical Network Id - * @return list of ExternalFirewallDeviceVO for the devices added in to this physical network. - */ - List listByPhysicalNetwork(long physicalNetworkId); - - /** - * list the firewall devices added in to this physical network of certain provider type? - * @param physicalNetworkId physical Network Id - * @param provider_name netwrok service provider name - */ - List listByPhysicalNetworkAndProvider(long physicalNetworkId, String provider_name); - - /** - * list the firewall devices added in to this physical network by their allocation state - * @param physicalNetworkId physical Network Id - * @param provider_name netwrok service provider name - * @param allocationState firewall device allocation state - * @return list of ExternalFirewallDeviceVO for the devices in the physical network with a device allocation state - */ - List listByProviderAndDeviceAllocationState(long physicalNetworkId, String provider_name, FirewallDeviceAllocationState allocationState); - - /** - * list the load balancer devices added in to this physical network by the device status (enabled/disabled) - * @param physicalNetworkId physical Network Id - * @param provider_name netwrok service provider name - * @param state firewall device status - * @return list of ExternalFirewallDeviceVO for the devices in the physical network with a device state - */ - List listByProviderAndDeviceStaus(long physicalNetworkId, String provider_name, FirewallDeviceState state); -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/ExternalFirewallDeviceDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/ExternalFirewallDeviceDaoImpl.java b/server/src/com/cloud/network/dao/ExternalFirewallDeviceDaoImpl.java deleted file mode 100644 index 01f8861..0000000 --- a/server/src/com/cloud/network/dao/ExternalFirewallDeviceDaoImpl.java +++ /dev/null @@ -1,96 +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.dao; - -import java.util.List; -import javax.ejb.Local; - -import org.springframework.stereotype.Component; - -import com.cloud.network.dao.ExternalFirewallDeviceVO.FirewallDeviceAllocationState; -import com.cloud.network.dao.ExternalFirewallDeviceVO.FirewallDeviceState; -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.SearchCriteria.Op; - -@Component -@Local(value=ExternalFirewallDeviceDao.class) @DB(txn=false) -public class ExternalFirewallDeviceDaoImpl extends GenericDaoBase implements ExternalFirewallDeviceDao { - final SearchBuilder physicalNetworkServiceProviderSearch; - final SearchBuilder physicalNetworkIdSearch; - final SearchBuilder allocationStateSearch; - final SearchBuilder deviceStatusSearch; - - protected ExternalFirewallDeviceDaoImpl() { - physicalNetworkIdSearch = createSearchBuilder(); - physicalNetworkIdSearch.and("physicalNetworkId", physicalNetworkIdSearch.entity().getPhysicalNetworkId(), Op.EQ); - physicalNetworkIdSearch.done(); - - physicalNetworkServiceProviderSearch = createSearchBuilder(); - physicalNetworkServiceProviderSearch.and("physicalNetworkId", physicalNetworkServiceProviderSearch.entity().getPhysicalNetworkId(), Op.EQ); - physicalNetworkServiceProviderSearch.and("networkServiceProviderName", physicalNetworkServiceProviderSearch.entity().getProviderName(), Op.EQ); - physicalNetworkServiceProviderSearch.done(); - - allocationStateSearch = createSearchBuilder(); - allocationStateSearch.and("physicalNetworkId", allocationStateSearch.entity().getPhysicalNetworkId(), Op.EQ); - allocationStateSearch.and("providerName", allocationStateSearch.entity().getProviderName(), Op.EQ); - allocationStateSearch.and("allocationState", allocationStateSearch.entity().getAllocationState(), Op.EQ); - allocationStateSearch.done(); - - deviceStatusSearch = createSearchBuilder(); - deviceStatusSearch.and("physicalNetworkId", deviceStatusSearch.entity().getPhysicalNetworkId(), Op.EQ); - deviceStatusSearch.and("providerName", deviceStatusSearch.entity().getProviderName(), Op.EQ); - deviceStatusSearch.and("deviceState", deviceStatusSearch.entity().getDeviceState(), Op.EQ); - deviceStatusSearch.done(); - } - - @Override - public List listByPhysicalNetwork(long physicalNetworkId) { - SearchCriteria sc = physicalNetworkIdSearch.create(); - sc.setParameters("physicalNetworkId", physicalNetworkId); - return search(sc, null); - } - - @Override - public List listByPhysicalNetworkAndProvider(long physicalNetworkId, String providerName) { - SearchCriteria sc = physicalNetworkServiceProviderSearch.create(); - sc.setParameters("physicalNetworkId", physicalNetworkId); - sc.setParameters("networkServiceProviderName", providerName); - return search(sc, null); - } - - @Override - public List listByProviderAndDeviceAllocationState(long physicalNetworkId, String providerName, FirewallDeviceAllocationState allocationState) { - SearchCriteria sc = allocationStateSearch.create(); - sc.setParameters("physicalNetworkId", physicalNetworkId); - sc.setParameters("providerName", providerName); - sc.setParameters("allocationState", allocationState); - return search(sc, null); - } - - @Override - public List listByProviderAndDeviceStaus(long physicalNetworkId, String providerName, FirewallDeviceState state) { - SearchCriteria sc = deviceStatusSearch.create(); - sc.setParameters("physicalNetworkId", physicalNetworkId); - sc.setParameters("providerName", providerName); - sc.setParameters("deviceState", state); - return search(sc, null); - } - -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/ExternalFirewallDeviceVO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/ExternalFirewallDeviceVO.java b/server/src/com/cloud/network/dao/ExternalFirewallDeviceVO.java deleted file mode 100644 index 31750b4..0000000 --- a/server/src/com/cloud/network/dao/ExternalFirewallDeviceVO.java +++ /dev/null @@ -1,161 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.network.dao; - -import org.apache.cloudstack.api.Identity; -import org.apache.cloudstack.api.InternalIdentity; - -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; - -/** - * ExternalFirewallDeviceVO contains information of a external firewall device (Juniper SRX) added into a deployment - */ - -@Entity -@Table(name="external_firewall_devices") -public class ExternalFirewallDeviceVO implements InternalIdentity, Identity { - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "id") - private long id; - - @Column(name="uuid") - private String uuid; - - @Column(name = "host_id") - private long hostId; - - @Column(name = "physical_network_id") - private long physicalNetworkId; - - @Column(name = "provider_name") - private String providerName; - - @Column(name = "device_name") - private String deviceName; - - @Column(name="device_state") - @Enumerated(value=EnumType.STRING) - FirewallDeviceState deviceState; - - @Column(name="is_dedicated") - private boolean isDedicatedDevice; - - @Column(name = "capacity") - private long capacity; - - @Column(name = "allocation_state") - @Enumerated(value=EnumType.STRING) - private FirewallDeviceAllocationState allocationState; - - //keeping it enum for future possible states Maintenance, Shutdown - public enum FirewallDeviceState { - Enabled, - Disabled - } - - public enum FirewallDeviceAllocationState { - Free, - Allocated - } - - public ExternalFirewallDeviceVO(long hostId, long physicalNetworkId, String provider_name, String device_name, long capacity, boolean dedicated) { - this.physicalNetworkId = physicalNetworkId; - this.providerName = provider_name; - this.deviceName = device_name; - this.hostId = hostId; - this.deviceState = FirewallDeviceState.Disabled; - this.allocationState = FirewallDeviceAllocationState.Free; - this.capacity = capacity; - this.isDedicatedDevice = dedicated; - this.deviceState = FirewallDeviceState.Enabled; - this.uuid = UUID.randomUUID().toString(); - } - - public ExternalFirewallDeviceVO() { - this.uuid = UUID.randomUUID().toString(); - } - - public long getId() { - return id; - } - - public long getPhysicalNetworkId() { - return physicalNetworkId; - } - - public String getProviderName() { - return providerName; - } - - public String getDeviceName() { - return deviceName; - } - - public long getHostId() { - return hostId; - } - - public long getCapacity() { - return capacity; - } - - public void setCapacity(long capacity) { - this.capacity = capacity; - } - - public FirewallDeviceState getDeviceState() { - return deviceState; - } - - public void setDeviceState(FirewallDeviceState state) { - this.deviceState = state; - } - - public FirewallDeviceAllocationState getAllocationState() { - return allocationState; - } - - public void setAllocationState(FirewallDeviceAllocationState allocationState) { - this.allocationState = allocationState; - } - - public boolean getIsDedicatedDevice() { - return isDedicatedDevice; - } - - public void setIsDedicatedDevice(boolean isDedicated) { - isDedicatedDevice = isDedicated; - } - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDao.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDao.java b/server/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDao.java deleted file mode 100644 index b7baa7e..0000000 --- a/server/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDao.java +++ /dev/null @@ -1,74 +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.dao; - -import com.cloud.network.dao.ExternalLoadBalancerDeviceVO.LBDeviceAllocationState; -import com.cloud.network.dao.ExternalLoadBalancerDeviceVO.LBDeviceState; -import com.cloud.utils.db.GenericDao; - -import java.util.List; - -public interface ExternalLoadBalancerDeviceDao extends GenericDao { - - /** - * list all the load balancer devices added in to this physical network? - * @param physicalNetworkId physical Network Id - * @return list of ExternalLoadBalancerDeviceVO for the devices in the physical network. - */ - List listByPhysicalNetwork(long physicalNetworkId); - - /** - * list the load balancer devices added in to this physical network of certain provider type? - * @param physicalNetworkId physical Network Id - * @param provider_name netwrok service provider name - */ - List listByPhysicalNetworkAndProvider(long physicalNetworkId, String provider_name); - - /** - * list the load balancer devices added in to this physical network by their allocation state - * @param physicalNetworkId physical Network Id - * @param provider_name netwrok service provider name - * @param allocationState load balancer device allocation state - * @return list of ExternalLoadBalancerDeviceVO for the devices in the physical network with a device allocation state - */ - List listByProviderAndDeviceAllocationState(long physicalNetworkId, String provider_name, LBDeviceAllocationState allocationState); - - /** - * list the load balancer devices added in to this physical network by the device status (enabled/disabled) - * @param physicalNetworkId physical Network Id - * @param provider_name netwrok service provider name - * @param state load balancer device status - * @return list of ExternalLoadBalancerDeviceVO for the devices in the physical network with a device state - */ - List listByProviderAndDeviceStaus(long physicalNetworkId, String provider_name, LBDeviceState state); - - /** - * list the load balancer devices added in to this physical network by the managed type (external/cloudstack managed) - * @param physicalNetworkId physical Network Id - * @param provider_name netwrok service provider name - * @param managed managed type - * @return list of ExternalLoadBalancerDeviceVO for the devices in to this physical network of a managed type - */ - List listByProviderAndManagedType(long physicalNetworkId, String provider_name, boolean managed); - - /** - * Find the external load balancer device that is provisioned as GSLB service provider in the pyshical network - * @param physicalNetworkId physical Network Id - * @return ExternalLoadBalancerDeviceVO for the device acting as GSLB provider in the physical network - */ - ExternalLoadBalancerDeviceVO findGslbServiceProvider(long physicalNetworkId, String providerName); -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDaoImpl.java b/server/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDaoImpl.java deleted file mode 100644 index ea6437d..0000000 --- a/server/src/com/cloud/network/dao/ExternalLoadBalancerDeviceDaoImpl.java +++ /dev/null @@ -1,127 +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.dao; - -import com.cloud.network.dao.ExternalLoadBalancerDeviceVO.LBDeviceAllocationState; -import com.cloud.network.dao.ExternalLoadBalancerDeviceVO.LBDeviceState; -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.SearchCriteria.Op; -import org.springframework.stereotype.Component; - -import javax.ejb.Local; -import java.util.List; - -@Component -@Local(value=ExternalLoadBalancerDeviceDao.class) @DB(txn=false) -public class ExternalLoadBalancerDeviceDaoImpl extends GenericDaoBase implements ExternalLoadBalancerDeviceDao { - final SearchBuilder physicalNetworkIdSearch; - final SearchBuilder physicalNetworkServiceProviderSearch; - final SearchBuilder allocationStateSearch; - final SearchBuilder deviceStatusSearch; - final SearchBuilder deviceManagedTypeSearch; - final SearchBuilder gslbProviderSearch; - - public ExternalLoadBalancerDeviceDaoImpl() { - super(); - - physicalNetworkIdSearch = createSearchBuilder(); - physicalNetworkIdSearch.and("physicalNetworkId", physicalNetworkIdSearch.entity().getPhysicalNetworkId(), Op.EQ); - physicalNetworkIdSearch.done(); - - physicalNetworkServiceProviderSearch = createSearchBuilder(); - physicalNetworkServiceProviderSearch.and("physicalNetworkId", physicalNetworkServiceProviderSearch.entity().getPhysicalNetworkId(), Op.EQ); - physicalNetworkServiceProviderSearch.and("providerName", physicalNetworkServiceProviderSearch.entity().getProviderName(), Op.EQ); - physicalNetworkServiceProviderSearch.done(); - - allocationStateSearch = createSearchBuilder(); - allocationStateSearch.and("physicalNetworkId", allocationStateSearch.entity().getPhysicalNetworkId(), Op.EQ); - allocationStateSearch.and("providerName", allocationStateSearch.entity().getProviderName(), Op.EQ); - allocationStateSearch.and("allocationState", allocationStateSearch.entity().getAllocationState(), Op.EQ); - allocationStateSearch.done(); - - deviceStatusSearch = createSearchBuilder(); - deviceStatusSearch.and("physicalNetworkId", deviceStatusSearch.entity().getPhysicalNetworkId(), Op.EQ); - deviceStatusSearch.and("providerName", deviceStatusSearch.entity().getProviderName(), Op.EQ); - deviceStatusSearch.and("deviceState", deviceStatusSearch.entity().getState(), Op.EQ); - deviceStatusSearch.done(); - - deviceManagedTypeSearch = createSearchBuilder(); - deviceManagedTypeSearch.and("physicalNetworkId", deviceManagedTypeSearch.entity().getPhysicalNetworkId(), Op.EQ); - deviceManagedTypeSearch.and("providerName", deviceManagedTypeSearch.entity().getProviderName(), Op.EQ); - deviceManagedTypeSearch.and("managedType", deviceManagedTypeSearch.entity().getIsManagedDevice(), Op.EQ); - deviceManagedTypeSearch.done(); - - gslbProviderSearch = createSearchBuilder(); - gslbProviderSearch.and("physicalNetworkId", gslbProviderSearch.entity().getPhysicalNetworkId(), Op.EQ); - gslbProviderSearch.and("providerName", gslbProviderSearch.entity().getProviderName(), Op.EQ); - gslbProviderSearch.and("gslbProvider", gslbProviderSearch.entity().getGslbProvider(), Op.EQ); - - } - - public List listByPhysicalNetwork(long physicalNetworkId) { - SearchCriteria sc = physicalNetworkIdSearch.create(); - sc.setParameters("physicalNetworkId", physicalNetworkId); - return search(sc, null); - } - - @Override - public List listByPhysicalNetworkAndProvider(long physicalNetworkId, String provider_name) { - SearchCriteria sc = physicalNetworkServiceProviderSearch.create(); - sc.setParameters("physicalNetworkId", physicalNetworkId); - sc.setParameters("providerName", provider_name); - return search(sc, null); - } - - @Override - public List listByProviderAndDeviceAllocationState(long physicalNetworkId, String provider_name, LBDeviceAllocationState state) { - SearchCriteria sc = allocationStateSearch.create(); - sc.setParameters("physicalNetworkId", physicalNetworkId); - sc.setParameters("providerName", provider_name); - sc.setParameters("allocationState", state); - return search(sc, null); - } - - @Override - public List listByProviderAndDeviceStaus(long physicalNetworkId, String providerName, LBDeviceState state) { - SearchCriteria sc = deviceStatusSearch.create(); - sc.setParameters("physicalNetworkId", physicalNetworkId); - sc.setParameters("providerName", providerName); - sc.setParameters("deviceState", state); - return search(sc, null); - } - - @Override - public List listByProviderAndManagedType(long physicalNetworkId, String providerName, boolean managed) { - SearchCriteria sc = deviceManagedTypeSearch.create(); - sc.setParameters("physicalNetworkId", physicalNetworkId); - sc.setParameters("providerName", providerName); - sc.setParameters("managedType", managed); - return search(sc, null); - } - - @Override - public ExternalLoadBalancerDeviceVO findGslbServiceProvider(long physicalNetworkId, String providerName) { - SearchCriteria sc = gslbProviderSearch.create(); - sc.setParameters("physicalNetworkId", physicalNetworkId); - sc.setParameters("providerName", providerName); - sc.setParameters("gslbProvider", true); - return findOneBy(sc); - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/ExternalLoadBalancerDeviceVO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/ExternalLoadBalancerDeviceVO.java b/server/src/com/cloud/network/dao/ExternalLoadBalancerDeviceVO.java deleted file mode 100644 index 04714a6..0000000 --- a/server/src/com/cloud/network/dao/ExternalLoadBalancerDeviceVO.java +++ /dev/null @@ -1,227 +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.dao; - -import org.apache.cloudstack.api.Identity; -import org.apache.cloudstack.api.InternalIdentity; -import org.apache.cloudstack.network.ExternalNetworkDeviceManager; - -import javax.persistence.*; -import java.util.UUID; - -/** - * ExternalLoadBalancerDeviceVO contains information on external load balancer devices (F5/Netscaler VPX,MPX,SDX) added into a deployment - */ - -@Entity -@Table(name="external_load_balancer_devices") -public class ExternalLoadBalancerDeviceVO implements InternalIdentity, Identity { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "id") - private long id; - - @Column(name="uuid") - private String uuid; - - @Column(name = "host_id") - private long hostId; - - @Column(name = "physical_network_id") - private long physicalNetworkId; - - @Column(name = "provider_name") - private String providerName; - - @Column(name = "device_name") - private String deviceName; - - @Column(name="device_state") - @Enumerated(value=EnumType.STRING) - private LBDeviceState state; - - @Column(name = "allocation_state") - @Enumerated(value=EnumType.STRING) - private LBDeviceAllocationState allocationState; - - @Column(name="is_managed") - private boolean isManagedDevice; - - @Column(name="is_dedicated") - private boolean isDedicatedDevice; - - @Column(name="is_gslb_provider") - private boolean gslbProvider; - - @Column(name="gslb_site_publicip") - private String gslbSitePublicIP; - - @Column(name="gslb_site_privateip") - private String gslbSitePrivateIP; - - @Column(name = "parent_host_id") - private long parentHostId; - - @Column(name = "capacity") - private long capacity; - - //keeping it enum for future possible states Maintenance, Shutdown - public enum LBDeviceState { - Enabled, - Disabled - } - - public enum LBDeviceAllocationState { - Free, // In this state no networks are using this device for load balancing - Shared, // In this state one or more networks will be using this device for load balancing - Dedicated, // In this state this device is dedicated for a single network - Provider // This state is set only for device that can dynamically provision LB appliances - } - - public ExternalLoadBalancerDeviceVO(long hostId, long physicalNetworkId, String provider_name, String device_name, - long capacity, boolean dedicated, boolean gslbProvider) { - this.physicalNetworkId = physicalNetworkId; - this.providerName = provider_name; - this.deviceName = device_name; - this.hostId = hostId; - this.state = LBDeviceState.Disabled; - this.allocationState = LBDeviceAllocationState.Free; - this.capacity = capacity; - this.isDedicatedDevice = dedicated; - this.isManagedDevice = false; - this.state = LBDeviceState.Enabled; - this.uuid = UUID.randomUUID().toString(); - this.gslbProvider = gslbProvider; - this.gslbSitePublicIP = null; - this.gslbSitePrivateIP = null; - if (device_name.equalsIgnoreCase(ExternalNetworkDeviceManager.NetworkDevice.NetscalerSDXLoadBalancer.getName())) { - this.allocationState = LBDeviceAllocationState.Provider; - } - } - - public ExternalLoadBalancerDeviceVO(long hostId, long physicalNetworkId, String provider_name, String device_name, - long capacity, boolean dedicated, boolean managed, long parentHostId) { - this(hostId, physicalNetworkId, provider_name, device_name, capacity, dedicated, false); - this.isManagedDevice = managed; - this.parentHostId = parentHostId; - } - - public ExternalLoadBalancerDeviceVO() { - this.uuid = UUID.randomUUID().toString(); - } - - public long getId() { - return id; - } - - public long getPhysicalNetworkId() { - return physicalNetworkId; - } - - public String getProviderName() { - return providerName; - } - - public String getDeviceName() { - return deviceName; - } - - public long getHostId() { - return hostId; - } - - public long getParentHostId() { - return parentHostId; - } - - public void setParentHostId(long parentHostId) { - this.parentHostId = parentHostId; - } - - public long getCapacity() { - return capacity; - } - - public void setCapacity(long capacity) { - this.capacity = capacity; - } - - public LBDeviceState getState() { - return state; - } - - public void setState(LBDeviceState state) { - this.state = state; - } - - public LBDeviceAllocationState getAllocationState() { - return allocationState; - } - - public void setAllocationState(LBDeviceAllocationState allocationState) { - this.allocationState = allocationState; - } - - public boolean getIsManagedDevice() { - return isManagedDevice; - } - - public void setIsManagedDevice(boolean managed) { - this.isManagedDevice = managed; - } - - public boolean getIsDedicatedDevice() { - return isDedicatedDevice; - } - - public void setIsDedicatedDevice(boolean isDedicated) { - isDedicatedDevice = isDedicated; - } - - public boolean getGslbProvider() { - return gslbProvider; - } - - public void setGslbProvider(boolean gslbProvider) { - gslbProvider = gslbProvider; - } - - public void setGslbSitePublicIP(String gslbSitePublicIP) { - this.gslbSitePublicIP = gslbSitePublicIP; - } - - public String getGslbSitePublicIP() { - return gslbSitePublicIP; - } - - public void setGslbSitePrivateIP(String gslbSitePrivateIP) { - this.gslbSitePrivateIP = gslbSitePrivateIP; - } - - public String getGslbSitePrivateIP() { - return gslbSitePrivateIP; - } - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/FirewallRulesCidrsDao.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/FirewallRulesCidrsDao.java b/server/src/com/cloud/network/dao/FirewallRulesCidrsDao.java deleted file mode 100644 index d020ea7..0000000 --- a/server/src/com/cloud/network/dao/FirewallRulesCidrsDao.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.network.dao; - -import java.util.List; - -import com.cloud.utils.db.GenericDao; - -public interface FirewallRulesCidrsDao extends GenericDao { - - void persist(long firewallRuleId, List sourceCidrs); - - List getSourceCidrs(long firewallRuleId); - -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/FirewallRulesCidrsDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/FirewallRulesCidrsDaoImpl.java b/server/src/com/cloud/network/dao/FirewallRulesCidrsDaoImpl.java deleted file mode 100644 index b007e19..0000000 --- a/server/src/com/cloud/network/dao/FirewallRulesCidrsDaoImpl.java +++ /dev/null @@ -1,70 +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.dao; - -import java.util.ArrayList; -import java.util.List; - -import javax.ejb.Local; - -import org.apache.log4j.Logger; -import org.springframework.stereotype.Component; - -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=FirewallRulesCidrsDao.class) -public class FirewallRulesCidrsDaoImpl extends GenericDaoBase implements FirewallRulesCidrsDao { - private static final Logger s_logger = Logger.getLogger(FirewallRulesCidrsDaoImpl.class); - protected final SearchBuilder CidrsSearch; - - protected FirewallRulesCidrsDaoImpl() { - CidrsSearch = createSearchBuilder(); - CidrsSearch.and("firewallRuleId", CidrsSearch.entity().getFirewallRuleId(), SearchCriteria.Op.EQ); - CidrsSearch.done(); - } - - @Override @DB - public List getSourceCidrs(long firewallRuleId) { - SearchCriteria sc = CidrsSearch.create(); - sc.setParameters("firewallRuleId", firewallRuleId); - - List results = search(sc, null); - List cidrs = new ArrayList(results.size()); - for (FirewallRulesCidrsVO result : results) { - cidrs.add(result.getCidr()); - } - - return cidrs; - } - - @Override @DB - public void persist(long firewallRuleId, List sourceCidrs) { - Transaction txn = Transaction.currentTxn(); - - txn.start(); - for (String tag : sourceCidrs) { - FirewallRulesCidrsVO vo = new FirewallRulesCidrsVO(firewallRuleId, tag); - persist(vo); - } - txn.commit(); - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/FirewallRulesCidrsVO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/FirewallRulesCidrsVO.java b/server/src/com/cloud/network/dao/FirewallRulesCidrsVO.java deleted file mode 100644 index 75b8919..0000000 --- a/server/src/com/cloud/network/dao/FirewallRulesCidrsVO.java +++ /dev/null @@ -1,65 +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.dao; - -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=("firewall_rules_cidrs")) -public class FirewallRulesCidrsVO implements InternalIdentity { - @Id - @GeneratedValue(strategy=GenerationType.IDENTITY) - @Column(name="id") - private Long id; - - @Column(name="firewall_rule_id") - private long firewallRuleId; - - @Column(name="source_cidr") - private String sourceCidrList; - - public FirewallRulesCidrsVO() { } - - public FirewallRulesCidrsVO(long firewallRuleId, String sourceCidrList) { - this.firewallRuleId = firewallRuleId; - this.sourceCidrList = sourceCidrList; - } - - public long getId() { - return id; - } - - public long getFirewallRuleId() { - return firewallRuleId; - } - - public String getCidr() { - return sourceCidrList; - } - - public String getSourceCidrList() { - return sourceCidrList; - } - -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/FirewallRulesDao.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/FirewallRulesDao.java b/server/src/com/cloud/network/dao/FirewallRulesDao.java deleted file mode 100644 index 0bbaa93..0000000 --- a/server/src/com/cloud/network/dao/FirewallRulesDao.java +++ /dev/null @@ -1,65 +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.dao; - -import java.util.List; - -import com.cloud.host.HostVO; -import com.cloud.network.rules.FirewallRule; -import com.cloud.network.rules.FirewallRuleVO; -import com.cloud.utils.db.GenericDao; - -/* - * Data Access Object for user_ip_address and ip_forwarding tables - */ -public interface FirewallRulesDao extends GenericDao { - - List listByIpAndPurposeAndNotRevoked(long ipAddressId, FirewallRule.Purpose purpose); - - List listByNetworkAndPurposeAndNotRevoked(long networkId, FirewallRule.Purpose purpose); - - boolean setStateToAdd(FirewallRuleVO rule); - - boolean revoke(FirewallRuleVO rule); - - boolean releasePorts(long ipAddressId, String protocol, FirewallRule.Purpose purpose, int[] ports); - - List listByIpAndPurpose(long ipAddressId, FirewallRule.Purpose purpose); - - List listByNetworkAndPurpose(long networkId, FirewallRule.Purpose purpose); - - List listStaticNatByVmId(long vmId); - - List listByIpPurposeAndProtocolAndNotRevoked(long ipAddressId, Integer startPort, Integer endPort, String protocol, FirewallRule.Purpose purpose); - - FirewallRuleVO findByRelatedId(long ruleId); - - List listSystemRules(); - - List listByIp(long ipAddressId); - - List listByIpAndNotRevoked(long ipAddressId); - - long countRulesByIpId(long sourceIpId); - - List listByNetworkPurposeTrafficTypeAndNotRevoked(long networkId, FirewallRule.Purpose purpose, FirewallRule.TrafficType trafficType); - List listByNetworkPurposeTrafficType(long networkId, FirewallRule.Purpose purpose, FirewallRule.TrafficType trafficType); - - List listByIpAndPurposeWithState(Long addressId, FirewallRule.Purpose purpose, FirewallRule.State state); - - void loadSourceCidrs(FirewallRuleVO rule); -}