You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by al...@apache.org on 2013/05/08 00:02:28 UTC
[72/72] [abbrv] git commit: updated refs/heads/internallb to 43e1667
Moved all DAOs and VOs to the cloud-engine-schema project
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/43e1667f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/43e1667f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/43e1667f
Branch: refs/heads/internallb
Commit: 43e1667f90b01e2b4095009b997b3b2665087fb4
Parents: 2fd94c8
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Tue May 7 13:26:53 2013 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Tue May 7 14:31:56 2013 -0700
----------------------------------------------------------------------
api/src/com/cloud/event/EventTypes.java | 1 +
.../apache/cloudstack/api/ResponseGenerator.java | 7 +-
client/tomcatconf/applicationContext.xml.in | 2 +-
.../cloud/offerings/NetworkOfferingDetailsVO.java | 90 ++++++++++
.../offerings/dao/NetworkOfferingDetailsDao.java | 31 ++++
.../dao/NetworkOfferingDetailsDaoImpl.java | 79 +++++++++
.../lb/ApplicationLoadBalancerRuleVO.java | 133 +++++++++++++++
.../lb/dao/ApplicationLoadBalancerRuleDao.java | 35 ++++
.../lb/dao/ApplicationLoadBalancerRuleDaoImpl.java | 115 +++++++++++++
.../element/InternalLoadBalancerElement.java | 2 +-
.../lb/InternalLoadBalancerVMManagerImpl.java | 5 +-
.../ElementChildTestConfiguration.java | 6 +-
.../internallbelement/InternalLbElementTest.java | 2 +-
.../internallbvmmgr/InternalLBVMManagerTest.java | 2 +-
.../internallbvmmgr/LbChildTestConfiguration.java | 6 +-
server/src/com/cloud/api/ApiDBUtils.java | 12 +-
server/src/com/cloud/api/ApiResponseHelper.java | 1 +
server/src/com/cloud/network/NetworkModelImpl.java | 5 +-
.../src/com/cloud/network/NetworkServiceImpl.java | 1 -
.../network/lb/LoadBalancingRulesManagerImpl.java | 4 +-
.../cloud/offerings/NetworkOfferingDetailsVO.java | 90 ----------
.../offerings/dao/NetworkOfferingDetailsDao.java | 31 ----
.../dao/NetworkOfferingDetailsDaoImpl.java | 79 ---------
.../src/com/cloud/server/ManagementServerImpl.java | 79 +--------
.../lb/ApplicationLoadBalancerManagerImpl.java | 3 +-
.../network/lb/ApplicationLoadBalancerRuleVO.java | 131 --------------
.../lb/dao/ApplicationLoadBalancerRuleDao.java | 35 ----
.../lb/dao/ApplicationLoadBalancerRuleDaoImpl.java | 115 -------------
.../test/com/cloud/vpc/MockNetworkManagerImpl.java | 29 +--
.../cloudstack/lb/ApplicationLoadBalancerTest.java | 3 +-
.../cloudstack/lb/ChildTestConfiguration.java | 6 +-
31 files changed, 533 insertions(+), 607 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/api/src/com/cloud/event/EventTypes.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/event/EventTypes.java b/api/src/com/cloud/event/EventTypes.java
index 55652e6..09bbe0e 100755
--- a/api/src/com/cloud/event/EventTypes.java
+++ b/api/src/com/cloud/event/EventTypes.java
@@ -26,6 +26,7 @@ import com.cloud.dc.StorageNetworkIpRange;
import com.cloud.dc.Vlan;
import com.cloud.domain.Domain;
import com.cloud.host.Host;
+import com.cloud.network.GuestVlan;
import com.cloud.network.Network;
import com.cloud.network.PhysicalNetwork;
import com.cloud.network.PhysicalNetworkServiceProvider;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/api/src/org/apache/cloudstack/api/ResponseGenerator.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ResponseGenerator.java b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
index 8db784c..ab8f995 100644
--- a/api/src/org/apache/cloudstack/api/ResponseGenerator.java
+++ b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
@@ -21,7 +21,6 @@ import java.util.EnumSet;
import java.util.List;
import java.util.Map;
-import com.cloud.vm.NicSecondaryIp;
import org.apache.cloudstack.affinity.AffinityGroup;
import org.apache.cloudstack.affinity.AffinityGroupResponse;
import org.apache.cloudstack.api.ApiConstants.HostDetails;
@@ -48,6 +47,7 @@ import org.apache.cloudstack.api.response.FirewallResponse;
import org.apache.cloudstack.api.response.FirewallRuleResponse;
import org.apache.cloudstack.api.response.GlobalLoadBalancerResponse;
import org.apache.cloudstack.api.response.GuestOSResponse;
+import org.apache.cloudstack.api.response.GuestVlanRangeResponse;
import org.apache.cloudstack.api.response.HostForMigrationResponse;
import org.apache.cloudstack.api.response.HostResponse;
import org.apache.cloudstack.api.response.HypervisorCapabilitiesResponse;
@@ -126,9 +126,11 @@ import com.cloud.domain.Domain;
import com.cloud.event.Event;
import com.cloud.host.Host;
import com.cloud.hypervisor.HypervisorCapabilities;
+import com.cloud.network.GuestVlan;
import com.cloud.network.IpAddress;
import com.cloud.network.Network;
import com.cloud.network.Network.Service;
+import com.cloud.network.Networks.IsolationType;
import com.cloud.network.PhysicalNetwork;
import com.cloud.network.PhysicalNetworkServiceProvider;
import com.cloud.network.PhysicalNetworkTrafficType;
@@ -143,8 +145,6 @@ import com.cloud.network.as.AutoScaleVmGroup;
import com.cloud.network.as.AutoScaleVmProfile;
import com.cloud.network.as.Condition;
import com.cloud.network.as.Counter;
-import com.cloud.network.Networks.IsolationType;
-import com.cloud.network.as.*;
import com.cloud.network.router.VirtualRouter;
import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.HealthCheckPolicy;
@@ -183,6 +183,7 @@ import com.cloud.uservm.UserVm;
import com.cloud.utils.net.Ip;
import com.cloud.vm.InstanceGroup;
import com.cloud.vm.Nic;
+import com.cloud.vm.NicSecondaryIp;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.snapshot.VMSnapshot;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/client/tomcatconf/applicationContext.xml.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/applicationContext.xml.in b/client/tomcatconf/applicationContext.xml.in
index ce3e62f..67c8ccf 100644
--- a/client/tomcatconf/applicationContext.xml.in
+++ b/client/tomcatconf/applicationContext.xml.in
@@ -363,7 +363,7 @@
<bean id="vpcOfferingServiceMapDaoImpl" class="com.cloud.network.vpc.dao.VpcOfferingServiceMapDaoImpl" />
<bean id="vpcServiceMapDaoImpl" class="com.cloud.network.vpc.dao.VpcServiceMapDaoImpl" />
<bean id="vpnUserDaoImpl" class="com.cloud.network.dao.VpnUserDaoImpl" />
- <bean id="applicationLbRuleDaoImpl" class="org.apache.cloudstack.network.lb.dao.ApplicationLoadBalancerRuleDaoImpl" />
+ <bean id="applicationLbRuleDaoImpl" class="org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDaoImpl" />
<bean id="networkOfferingDetailsDaoImpl" class="com.cloud.offerings.dao.NetworkOfferingDetailsDaoImpl" />
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/engine/schema/src/com/cloud/offerings/NetworkOfferingDetailsVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/offerings/NetworkOfferingDetailsVO.java b/engine/schema/src/com/cloud/offerings/NetworkOfferingDetailsVO.java
new file mode 100644
index 0000000..6cd5abc
--- /dev/null
+++ b/engine/schema/src/com/cloud/offerings/NetworkOfferingDetailsVO.java
@@ -0,0 +1,90 @@
+// 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.offerings;
+
+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.InternalIdentity;
+
+import com.cloud.offering.NetworkOffering;
+import com.cloud.offering.NetworkOffering.Detail;
+
+@Entity
+@Table(name="network_offering_details")
+public class NetworkOfferingDetailsVO implements InternalIdentity {
+ @Id
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
+ @Column(name="id")
+ private long id;
+
+ @Column(name="network_offering_id")
+ private long offeringId;
+
+ @Enumerated(value=EnumType.STRING)
+ @Column(name="name")
+ private NetworkOffering.Detail name;
+
+ @Column(name="value", length=1024)
+ private String value;
+
+ public NetworkOfferingDetailsVO() {}
+
+ public NetworkOfferingDetailsVO(long offeringId, Detail detailName, String value) {
+ this.offeringId = offeringId;
+ this.name = detailName;
+ this.value = value;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public long getOfferingId() {
+ return offeringId;
+ }
+
+ public NetworkOffering.Detail getName() {
+ return name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public void setOfferingId(long offeringId) {
+ this.offeringId = offeringId;
+ }
+
+ public void setName(NetworkOffering.Detail name) {
+ this.name = name;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingDetailsDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingDetailsDao.java b/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingDetailsDao.java
new file mode 100644
index 0000000..ce209e0
--- /dev/null
+++ b/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingDetailsDao.java
@@ -0,0 +1,31 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.offerings.dao;
+
+
+import java.util.Map;
+
+import com.cloud.offering.NetworkOffering;
+import com.cloud.offering.NetworkOffering.Detail;
+import com.cloud.offerings.NetworkOfferingDetailsVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface NetworkOfferingDetailsDao extends GenericDao<NetworkOfferingDetailsVO, Long>{
+
+ Map<NetworkOffering.Detail,String> getNtwkOffDetails(long offeringId);
+ String getDetail(long offeringId, Detail detailName);
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingDetailsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingDetailsDaoImpl.java b/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingDetailsDaoImpl.java
new file mode 100644
index 0000000..068f390
--- /dev/null
+++ b/engine/schema/src/com/cloud/offerings/dao/NetworkOfferingDetailsDaoImpl.java
@@ -0,0 +1,79 @@
+// 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.offerings.dao;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.cloud.offering.NetworkOffering;
+import com.cloud.offering.NetworkOffering.Detail;
+import com.cloud.offerings.NetworkOfferingDetailsVO;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Func;
+import com.cloud.utils.db.SearchCriteria.Op;
+
+public class NetworkOfferingDetailsDaoImpl extends GenericDaoBase<NetworkOfferingDetailsVO, Long> implements NetworkOfferingDetailsDao{
+ protected final SearchBuilder<NetworkOfferingDetailsVO> DetailSearch;
+ private final GenericSearchBuilder<NetworkOfferingDetailsVO, String> ValueSearch;
+
+
+ public NetworkOfferingDetailsDaoImpl() {
+
+ DetailSearch = createSearchBuilder();
+ DetailSearch.and("offeringId", DetailSearch.entity().getOfferingId(), SearchCriteria.Op.EQ);
+ DetailSearch.and("name", DetailSearch.entity().getName(), SearchCriteria.Op.EQ);
+ DetailSearch.done();
+
+ ValueSearch = createSearchBuilder(String.class);
+ ValueSearch.select(null, Func.DISTINCT, ValueSearch.entity().getValue());
+ ValueSearch.and("offeringId", ValueSearch.entity().getOfferingId(), SearchCriteria.Op.EQ);
+ ValueSearch.and("name", ValueSearch.entity().getName(), Op.EQ);
+ ValueSearch.done();
+ }
+
+ @Override
+ public Map<NetworkOffering.Detail,String> getNtwkOffDetails(long offeringId) {
+ SearchCriteria<NetworkOfferingDetailsVO> sc = DetailSearch.create();
+ sc.setParameters("offeringId", offeringId);
+
+ List<NetworkOfferingDetailsVO> results = search(sc, null);
+ Map<NetworkOffering.Detail, String> details = new HashMap<NetworkOffering.Detail, String>(results.size());
+ for (NetworkOfferingDetailsVO result : results) {
+ details.put(result.getName(), result.getValue());
+ }
+
+ return details;
+ }
+
+ @Override
+ public String getDetail(long offeringId, Detail detailName) {
+ SearchCriteria<String> sc = ValueSearch.create();
+ sc.setParameters("name", detailName);
+ sc.setParameters("offeringId", offeringId);
+ List<String> results = customSearch(sc, null);
+ if (results.isEmpty()) {
+ return null;
+ } else {
+ return results.get(0);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/engine/schema/src/org/apache/cloudstack/lb/ApplicationLoadBalancerRuleVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/lb/ApplicationLoadBalancerRuleVO.java b/engine/schema/src/org/apache/cloudstack/lb/ApplicationLoadBalancerRuleVO.java
new file mode 100644
index 0000000..37a747e
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/lb/ApplicationLoadBalancerRuleVO.java
@@ -0,0 +1,133 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.lb;
+
+import javax.persistence.Column;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.PrimaryKeyJoinColumn;
+import javax.persistence.Table;
+
+import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
+
+import com.cloud.network.rules.FirewallRuleVO;
+import com.cloud.utils.net.Ip;
+import com.cloud.utils.net.NetUtils;
+
+/**
+ * This VO represent Internal Load Balancer rule.
+ * Instead of pointing to the public ip address id directly as External Load Balancer rule does, it refers to the ip address by its value/sourceNetworkid
+ *
+ */
+@Entity
+@Table(name=("load_balancing_rules"))
+@DiscriminatorValue(value="LoadBalancing")
+@PrimaryKeyJoinColumn(name="id")
+public class ApplicationLoadBalancerRuleVO extends FirewallRuleVO implements ApplicationLoadBalancerRule{
+ @Column(name="name")
+ private String name;
+
+ @Column(name="description", length=4096)
+ private String description;
+
+ @Column(name="algorithm")
+ private String algorithm;
+
+ @Column(name="default_port_start")
+ private int defaultPortStart;
+
+ @Column(name="default_port_end")
+ private int defaultPortEnd;
+
+ @Column(name="source_ip_address_network_id")
+ Long sourceIpNetworkId;
+
+ @Column(name="source_ip_address")
+ @Enumerated(value=EnumType.STRING)
+ private Ip sourceIp = null;
+
+ @Enumerated(value=EnumType.STRING)
+ @Column(name="scheme")
+ Scheme scheme;
+
+
+ public ApplicationLoadBalancerRuleVO() {
+ }
+
+ public ApplicationLoadBalancerRuleVO(String name, String description, int srcPort, int instancePort, String algorithm,
+ long networkId, long accountId, long domainId, Ip sourceIp, long sourceIpNtwkId, Scheme scheme) {
+ super(null, null, srcPort, srcPort, NetUtils.TCP_PROTO, networkId, accountId, domainId, Purpose.LoadBalancing, null, null,null, null, null);
+
+ this.name = name;
+ this.description = description;
+ this.algorithm = algorithm;
+ this.defaultPortStart = instancePort;
+ this.defaultPortEnd = instancePort;
+ this.sourceIp = sourceIp;
+ this.sourceIpNetworkId = sourceIpNtwkId;
+ this.scheme = scheme;
+ }
+
+
+ @Override
+ public Long getSourceIpNetworkId() {
+ return sourceIpNetworkId;
+ }
+
+ @Override
+ public Ip getSourceIp() {
+ return sourceIp;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public String getDescription() {
+ return description;
+ }
+
+ @Override
+ public String getAlgorithm() {
+ return algorithm;
+ }
+
+ @Override
+ public int getDefaultPortStart() {
+ return defaultPortStart;
+ }
+
+ @Override
+ public int getDefaultPortEnd() {
+ return defaultPortEnd;
+ }
+
+ @Override
+ public Scheme getScheme() {
+ return scheme;
+ }
+
+ @Override
+ public int getInstancePort() {
+ return defaultPortStart;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/engine/schema/src/org/apache/cloudstack/lb/dao/ApplicationLoadBalancerRuleDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/lb/dao/ApplicationLoadBalancerRuleDao.java b/engine/schema/src/org/apache/cloudstack/lb/dao/ApplicationLoadBalancerRuleDao.java
new file mode 100644
index 0000000..c385e62
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/lb/dao/ApplicationLoadBalancerRuleDao.java
@@ -0,0 +1,35 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.lb.dao;
+
+import java.util.List;
+
+import org.apache.cloudstack.lb.ApplicationLoadBalancerRuleVO;
+
+import com.cloud.network.rules.LoadBalancerContainer.Scheme;
+import com.cloud.utils.db.GenericDao;
+import com.cloud.utils.net.Ip;
+
+public interface ApplicationLoadBalancerRuleDao extends GenericDao<ApplicationLoadBalancerRuleVO, Long>{
+ List<ApplicationLoadBalancerRuleVO> listBySrcIpSrcNtwkId(Ip sourceIp, long sourceNetworkId);
+ List<String> listLbIpsBySourceIpNetworkId(long sourceIpNetworkId);
+ long countBySourceIp(Ip sourceIp, long sourceIpNetworkId);
+ List<ApplicationLoadBalancerRuleVO> listBySourceIpAndNotRevoked(Ip sourceIp, long sourceNetworkId);
+ List<String> listLbIpsBySourceIpNetworkIdAndScheme(long sourceIpNetworkId, Scheme scheme);
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/engine/schema/src/org/apache/cloudstack/lb/dao/ApplicationLoadBalancerRuleDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/lb/dao/ApplicationLoadBalancerRuleDaoImpl.java b/engine/schema/src/org/apache/cloudstack/lb/dao/ApplicationLoadBalancerRuleDaoImpl.java
new file mode 100644
index 0000000..880c67e
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/lb/dao/ApplicationLoadBalancerRuleDaoImpl.java
@@ -0,0 +1,115 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.lb.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.apache.cloudstack.lb.ApplicationLoadBalancerRuleVO;
+import org.springframework.stereotype.Component;
+
+import com.cloud.network.rules.FirewallRule;
+import com.cloud.network.rules.LoadBalancerContainer.Scheme;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.GenericSearchBuilder;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Func;
+import com.cloud.utils.db.SearchCriteria.Op;
+import com.cloud.utils.net.Ip;
+
+@Component
+@Local(value = { ApplicationLoadBalancerRuleDao.class })
+public class ApplicationLoadBalancerRuleDaoImpl extends GenericDaoBase<ApplicationLoadBalancerRuleVO, Long> implements ApplicationLoadBalancerRuleDao{
+ protected final SearchBuilder<ApplicationLoadBalancerRuleVO> AllFieldsSearch;
+ final GenericSearchBuilder<ApplicationLoadBalancerRuleVO, String> listIps;
+ final GenericSearchBuilder<ApplicationLoadBalancerRuleVO, Long> CountBy;
+ protected final SearchBuilder<ApplicationLoadBalancerRuleVO> NotRevokedSearch;
+
+
+
+ protected ApplicationLoadBalancerRuleDaoImpl() {
+ AllFieldsSearch = createSearchBuilder();
+ AllFieldsSearch.and("sourceIp", AllFieldsSearch.entity().getSourceIp(), SearchCriteria.Op.EQ);
+ AllFieldsSearch.and("sourceIpNetworkId", AllFieldsSearch.entity().getSourceIpNetworkId(), SearchCriteria.Op.EQ);
+ AllFieldsSearch.and("networkId", AllFieldsSearch.entity().getNetworkId(), SearchCriteria.Op.EQ);
+ AllFieldsSearch.and("scheme", AllFieldsSearch.entity().getScheme(), SearchCriteria.Op.EQ);
+ AllFieldsSearch.done();
+
+ listIps = createSearchBuilder(String.class);
+ listIps.select(null, Func.DISTINCT, listIps.entity().getSourceIp());
+ listIps.and("sourceIpNetworkId", listIps.entity().getSourceIpNetworkId(), Op.EQ);
+ listIps.and("scheme", listIps.entity().getScheme(), Op.EQ);
+ listIps.done();
+
+ CountBy = createSearchBuilder(Long.class);
+ CountBy.select(null, Func.COUNT, CountBy.entity().getId());
+ CountBy.and("sourceIp", CountBy.entity().getSourceIp(), Op.EQ);
+ CountBy.and("sourceIpNetworkId", CountBy.entity().getSourceIpNetworkId(), Op.EQ);
+ CountBy.done();
+
+ NotRevokedSearch = createSearchBuilder();
+ NotRevokedSearch.and("sourceIp", NotRevokedSearch.entity().getSourceIp(), SearchCriteria.Op.EQ);
+ NotRevokedSearch.and("sourceIpNetworkId", NotRevokedSearch.entity().getSourceIpNetworkId(), SearchCriteria.Op.EQ);
+ NotRevokedSearch.and("state", NotRevokedSearch.entity().getState(), SearchCriteria.Op.NEQ);
+ NotRevokedSearch.done();
+ }
+
+ @Override
+ public List<ApplicationLoadBalancerRuleVO> listBySrcIpSrcNtwkId(Ip sourceIp, long sourceNetworkId) {
+ SearchCriteria<ApplicationLoadBalancerRuleVO> sc = AllFieldsSearch.create();
+ sc.setParameters("sourceIp", sourceIp);
+ sc.setParameters("sourceIpNetworkId", sourceNetworkId);
+ return listBy(sc);
+ }
+
+ @Override
+ public List<String> listLbIpsBySourceIpNetworkId(long sourceIpNetworkId) {
+ SearchCriteria<String> sc = listIps.create();
+ sc.setParameters("sourceIpNetworkId", sourceIpNetworkId);
+ return customSearch(sc, null);
+ }
+
+ @Override
+ public long countBySourceIp(Ip sourceIp, long sourceIpNetworkId) {
+ SearchCriteria<Long> sc = CountBy.create();
+ sc.setParameters("sourceIp", sourceIp);
+ sc.setParameters("sourceIpNetworkId", sourceIpNetworkId);
+ List<Long> results = customSearch(sc, null);
+ return results.get(0);
+ }
+
+ @Override
+ public List<ApplicationLoadBalancerRuleVO> listBySourceIpAndNotRevoked(Ip sourceIp, long sourceNetworkId) {
+ SearchCriteria<ApplicationLoadBalancerRuleVO> sc = NotRevokedSearch.create();
+ sc.setParameters("sourceIp", sourceIp);
+ sc.setParameters("sourceIpNetworkId", sourceNetworkId);
+ sc.setParameters("state", FirewallRule.State.Revoke);
+ return listBy(sc);
+ }
+
+ @Override
+ public List<String> listLbIpsBySourceIpNetworkIdAndScheme(long sourceIpNetworkId, Scheme scheme) {
+ SearchCriteria<String> sc = listIps.create();
+ sc.setParameters("sourceIpNetworkId", sourceIpNetworkId);
+ sc.setParameters("scheme", scheme);
+ return customSearch(sc, null);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/element/InternalLoadBalancerElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/element/InternalLoadBalancerElement.java b/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/element/InternalLoadBalancerElement.java
index ea5d995..4b9308b 100644
--- a/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/element/InternalLoadBalancerElement.java
+++ b/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/element/InternalLoadBalancerElement.java
@@ -30,8 +30,8 @@ import javax.inject.Inject;
import org.apache.cloudstack.api.command.admin.internallb.ConfigureInternalLoadBalancerElementCmd;
import org.apache.cloudstack.api.command.admin.internallb.CreateInternalLoadBalancerElementCmd;
import org.apache.cloudstack.api.command.admin.internallb.ListInternalLoadBalancerElementsCmd;
+import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao;
import org.apache.cloudstack.network.lb.InternalLoadBalancerVMManager;
-import org.apache.cloudstack.network.lb.dao.ApplicationLoadBalancerRuleDao;
import org.apache.log4j.Logger;
import com.cloud.agent.api.to.LoadBalancerTO;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java b/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java
index a394d6e..fe32a7b 100644
--- a/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java
+++ b/plugins/network-elements/internal-loadbalancer/src/org/apache/cloudstack/network/lb/InternalLoadBalancerVMManagerImpl.java
@@ -25,7 +25,8 @@ import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
-import org.apache.cloudstack.network.lb.dao.ApplicationLoadBalancerRuleDao;
+import org.apache.cloudstack.lb.ApplicationLoadBalancerRuleVO;
+import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
@@ -119,7 +120,7 @@ import com.cloud.vm.dao.NicDao;
@Component
@Local(value = { InternalLoadBalancerVMManager.class, InternalLoadBalancerVMService.class})
public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements
-InternalLoadBalancerVMManager, VirtualMachineGuru<DomainRouterVO> {
+ InternalLoadBalancerVMManager, VirtualMachineGuru<DomainRouterVO> {
private static final Logger s_logger = Logger
.getLogger(InternalLoadBalancerVMManagerImpl.class);
static final private String _internalLbVmNamePrefix = "b";
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbelement/ElementChildTestConfiguration.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbelement/ElementChildTestConfiguration.java b/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbelement/ElementChildTestConfiguration.java
index 801020d..6959b95 100644
--- a/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbelement/ElementChildTestConfiguration.java
+++ b/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbelement/ElementChildTestConfiguration.java
@@ -18,8 +18,9 @@ package org.apache.cloudstack.internallbelement;
import java.io.IOException;
+import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao;
import org.apache.cloudstack.network.lb.InternalLoadBalancerVMManager;
-import org.apache.cloudstack.network.lb.dao.ApplicationLoadBalancerRuleDao;
+import org.apache.cloudstack.test.utils.SpringUtils;
import org.mockito.Mockito;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@@ -39,7 +40,6 @@ import com.cloud.network.dao.NetworkServiceMapDao;
import com.cloud.network.dao.PhysicalNetworkServiceProviderDao;
import com.cloud.network.dao.VirtualRouterProviderDao;
import com.cloud.user.AccountManager;
-import com.cloud.utils.component.SpringComponentScanUtils;
import com.cloud.vm.dao.DomainRouterDao;
@Configuration
@@ -118,7 +118,7 @@ public class ElementChildTestConfiguration {
public boolean match(MetadataReader mdr, MetadataReaderFactory arg1) throws IOException {
mdr.getClassMetadata().getClassName();
ComponentScan cs = ElementChildTestConfiguration.class.getAnnotation(ComponentScan.class);
- return SpringComponentScanUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
+ return SpringUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
}
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbelement/InternalLbElementTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbelement/InternalLbElementTest.java b/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbelement/InternalLbElementTest.java
index e4e5ca0..f19612f 100644
--- a/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbelement/InternalLbElementTest.java
+++ b/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbelement/InternalLbElementTest.java
@@ -28,8 +28,8 @@ import java.util.List;
import javax.inject.Inject;
+import org.apache.cloudstack.lb.ApplicationLoadBalancerRuleVO;
import org.apache.cloudstack.network.element.InternalLoadBalancerElement;
-import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRuleVO;
import org.apache.cloudstack.network.lb.InternalLoadBalancerVMManager;
import org.junit.Before;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/InternalLBVMManagerTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/InternalLBVMManagerTest.java b/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/InternalLBVMManagerTest.java
index 7e3c84d..a19a82e 100644
--- a/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/InternalLBVMManagerTest.java
+++ b/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/InternalLBVMManagerTest.java
@@ -26,7 +26,7 @@ import javax.inject.Inject;
import junit.framework.TestCase;
-import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRuleVO;
+import org.apache.cloudstack.lb.ApplicationLoadBalancerRuleVO;
import org.apache.cloudstack.network.lb.InternalLoadBalancerVMManager;
import org.junit.Before;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/LbChildTestConfiguration.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/LbChildTestConfiguration.java b/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/LbChildTestConfiguration.java
index 552a72c..0f24f96 100644
--- a/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/LbChildTestConfiguration.java
+++ b/plugins/network-elements/internal-loadbalancer/test/org/apache/cloudstack/internallbvmmgr/LbChildTestConfiguration.java
@@ -18,7 +18,8 @@ package org.apache.cloudstack.internallbvmmgr;
import java.io.IOException;
-import org.apache.cloudstack.network.lb.dao.ApplicationLoadBalancerRuleDao;
+import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao;
+import org.apache.cloudstack.test.utils.SpringUtils;
import org.mockito.Mockito;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@@ -45,7 +46,6 @@ import com.cloud.server.ConfigurationServer;
import com.cloud.service.dao.ServiceOfferingDao;
import com.cloud.storage.dao.VMTemplateDao;
import com.cloud.user.AccountManager;
-import com.cloud.utils.component.SpringComponentScanUtils;
import com.cloud.vm.VirtualMachineManager;
import com.cloud.vm.dao.DomainRouterDao;
import com.cloud.vm.dao.NicDao;
@@ -163,7 +163,7 @@ import com.cloud.vm.dao.NicDao;
public boolean match(MetadataReader mdr, MetadataReaderFactory arg1) throws IOException {
mdr.getClassMetadata().getClassName();
ComponentScan cs = LbChildTestConfiguration.class.getAnnotation(ComponentScan.class);
- return SpringComponentScanUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
+ return SpringUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/server/src/com/cloud/api/ApiDBUtils.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiDBUtils.java b/server/src/com/cloud/api/ApiDBUtils.java
index b5d45a6..67d2286 100755
--- a/server/src/com/cloud/api/ApiDBUtils.java
+++ b/server/src/com/cloud/api/ApiDBUtils.java
@@ -25,8 +25,6 @@ import java.util.Set;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
-import com.cloud.network.rules.LoadBalancer;
-import com.cloud.region.ha.GlobalLoadBalancingRulesService;
import org.apache.cloudstack.affinity.AffinityGroup;
import org.apache.cloudstack.affinity.AffinityGroupResponse;
import org.apache.cloudstack.affinity.dao.AffinityGroupDao;
@@ -37,8 +35,8 @@ import org.apache.cloudstack.api.response.AsyncJobResponse;
import org.apache.cloudstack.api.response.DiskOfferingResponse;
import org.apache.cloudstack.api.response.DomainRouterResponse;
import org.apache.cloudstack.api.response.EventResponse;
-import org.apache.cloudstack.api.response.HostResponse;
import org.apache.cloudstack.api.response.HostForMigrationResponse;
+import org.apache.cloudstack.api.response.HostResponse;
import org.apache.cloudstack.api.response.InstanceGroupResponse;
import org.apache.cloudstack.api.response.ProjectAccountResponse;
import org.apache.cloudstack.api.response.ProjectInvitationResponse;
@@ -52,7 +50,7 @@ import org.apache.cloudstack.api.response.UserResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.cloudstack.api.response.VolumeResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
-import org.apache.cloudstack.network.lb.dao.ApplicationLoadBalancerRuleDao;
+import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
import org.springframework.stereotype.Component;
@@ -131,8 +129,6 @@ import com.cloud.host.HostVO;
import com.cloud.host.dao.HostDao;
import com.cloud.host.dao.HostDetailsDao;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.network.dao.AccountGuestVlanMapDao;
-import com.cloud.network.dao.AccountGuestVlanMapVO;
import com.cloud.network.IpAddress;
import com.cloud.network.Network;
import com.cloud.network.Network.Capability;
@@ -158,6 +154,8 @@ import com.cloud.network.as.dao.AutoScaleVmGroupPolicyMapDao;
import com.cloud.network.as.dao.AutoScaleVmProfileDao;
import com.cloud.network.as.dao.ConditionDao;
import com.cloud.network.as.dao.CounterDao;
+import com.cloud.network.dao.AccountGuestVlanMapDao;
+import com.cloud.network.dao.AccountGuestVlanMapVO;
import com.cloud.network.dao.FirewallRulesCidrsDao;
import com.cloud.network.dao.FirewallRulesDao;
import com.cloud.network.dao.IPAddressDao;
@@ -182,6 +180,7 @@ import com.cloud.network.dao.Site2SiteVpnGatewayDao;
import com.cloud.network.dao.Site2SiteVpnGatewayVO;
import com.cloud.network.router.VirtualRouter;
import com.cloud.network.rules.FirewallRuleVO;
+import com.cloud.network.rules.LoadBalancer;
import com.cloud.network.security.SecurityGroup;
import com.cloud.network.security.SecurityGroupManager;
import com.cloud.network.security.SecurityGroupVO;
@@ -205,6 +204,7 @@ import com.cloud.projects.Project;
import com.cloud.projects.ProjectAccount;
import com.cloud.projects.ProjectInvitation;
import com.cloud.projects.ProjectService;
+import com.cloud.region.ha.GlobalLoadBalancingRulesService;
import com.cloud.resource.ResourceManager;
import com.cloud.server.Criteria;
import com.cloud.server.ManagementServer;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java
index 5af67b0..d5960ab 100755
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -3823,6 +3823,7 @@ public class ApiResponseHelper implements ResponseGenerator {
response.setEnabled(result.isEnabled());
response.setObjectName("internalloadbalancerelement");
+ return response;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/server/src/com/cloud/network/NetworkModelImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkModelImpl.java b/server/src/com/cloud/network/NetworkModelImpl.java
index 85fa170..f1d6285 100755
--- a/server/src/com/cloud/network/NetworkModelImpl.java
+++ b/server/src/com/cloud/network/NetworkModelImpl.java
@@ -32,7 +32,7 @@ import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
-import org.apache.cloudstack.network.lb.dao.ApplicationLoadBalancerRuleDao;
+import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
@@ -53,13 +53,11 @@ import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.UnsupportedServiceException;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.server.ConfigurationServer;
import com.cloud.network.IpAddress.State;
import com.cloud.network.Network.Capability;
import com.cloud.network.Network.GuestType;
import com.cloud.network.Network.Provider;
import com.cloud.network.Network.Service;
-import com.cloud.network.Networks.IsolationType;
import com.cloud.network.Networks.TrafficType;
import com.cloud.network.addr.PublicIp;
import com.cloud.network.dao.FirewallRulesDao;
@@ -94,6 +92,7 @@ import com.cloud.offerings.dao.NetworkOfferingDao;
import com.cloud.offerings.dao.NetworkOfferingDetailsDao;
import com.cloud.offerings.dao.NetworkOfferingServiceMapDao;
import com.cloud.projects.dao.ProjectAccountDao;
+import com.cloud.server.ConfigurationServer;
import com.cloud.user.Account;
import com.cloud.user.AccountVO;
import com.cloud.user.DomainManager;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/server/src/com/cloud/network/NetworkServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java
index eeb6e0f..ace7b8a 100755
--- a/server/src/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/com/cloud/network/NetworkServiceImpl.java
@@ -171,7 +171,6 @@ import com.cloud.vm.dao.NicSecondaryIpDao;
import com.cloud.vm.dao.NicSecondaryIpVO;
import com.cloud.vm.dao.UserVmDao;
import com.cloud.vm.dao.VMInstanceDao;
-<<<<<<< HEAD
import com.cloud.vm.*;
import com.cloud.vm.dao.*;
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
index ce87a59..520dd76 100755
--- a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
+++ b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
@@ -39,8 +39,8 @@ import org.apache.cloudstack.api.command.user.loadbalancer.ListLoadBalancerRuleI
import org.apache.cloudstack.api.command.user.loadbalancer.ListLoadBalancerRulesCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.UpdateLoadBalancerRuleCmd;
import org.apache.cloudstack.api.response.ServiceResponse;
-import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRuleVO;
-import org.apache.cloudstack.network.lb.dao.ApplicationLoadBalancerRuleDao;
+import org.apache.cloudstack.lb.ApplicationLoadBalancerRuleVO;
+import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/server/src/com/cloud/offerings/NetworkOfferingDetailsVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/offerings/NetworkOfferingDetailsVO.java b/server/src/com/cloud/offerings/NetworkOfferingDetailsVO.java
deleted file mode 100644
index 6cd5abc..0000000
--- a/server/src/com/cloud/offerings/NetworkOfferingDetailsVO.java
+++ /dev/null
@@ -1,90 +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.offerings;
-
-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.InternalIdentity;
-
-import com.cloud.offering.NetworkOffering;
-import com.cloud.offering.NetworkOffering.Detail;
-
-@Entity
-@Table(name="network_offering_details")
-public class NetworkOfferingDetailsVO implements InternalIdentity {
- @Id
- @GeneratedValue(strategy=GenerationType.IDENTITY)
- @Column(name="id")
- private long id;
-
- @Column(name="network_offering_id")
- private long offeringId;
-
- @Enumerated(value=EnumType.STRING)
- @Column(name="name")
- private NetworkOffering.Detail name;
-
- @Column(name="value", length=1024)
- private String value;
-
- public NetworkOfferingDetailsVO() {}
-
- public NetworkOfferingDetailsVO(long offeringId, Detail detailName, String value) {
- this.offeringId = offeringId;
- this.name = detailName;
- this.value = value;
- }
-
- public long getId() {
- return id;
- }
-
- public long getOfferingId() {
- return offeringId;
- }
-
- public NetworkOffering.Detail getName() {
- return name;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setId(long id) {
- this.id = id;
- }
-
- public void setOfferingId(long offeringId) {
- this.offeringId = offeringId;
- }
-
- public void setName(NetworkOffering.Detail name) {
- this.name = name;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/server/src/com/cloud/offerings/dao/NetworkOfferingDetailsDao.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/offerings/dao/NetworkOfferingDetailsDao.java b/server/src/com/cloud/offerings/dao/NetworkOfferingDetailsDao.java
deleted file mode 100644
index ce209e0..0000000
--- a/server/src/com/cloud/offerings/dao/NetworkOfferingDetailsDao.java
+++ /dev/null
@@ -1,31 +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.offerings.dao;
-
-
-import java.util.Map;
-
-import com.cloud.offering.NetworkOffering;
-import com.cloud.offering.NetworkOffering.Detail;
-import com.cloud.offerings.NetworkOfferingDetailsVO;
-import com.cloud.utils.db.GenericDao;
-
-public interface NetworkOfferingDetailsDao extends GenericDao<NetworkOfferingDetailsVO, Long>{
-
- Map<NetworkOffering.Detail,String> getNtwkOffDetails(long offeringId);
- String getDetail(long offeringId, Detail detailName);
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/server/src/com/cloud/offerings/dao/NetworkOfferingDetailsDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/offerings/dao/NetworkOfferingDetailsDaoImpl.java b/server/src/com/cloud/offerings/dao/NetworkOfferingDetailsDaoImpl.java
deleted file mode 100644
index 068f390..0000000
--- a/server/src/com/cloud/offerings/dao/NetworkOfferingDetailsDaoImpl.java
+++ /dev/null
@@ -1,79 +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.offerings.dao;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.cloud.offering.NetworkOffering;
-import com.cloud.offering.NetworkOffering.Detail;
-import com.cloud.offerings.NetworkOfferingDetailsVO;
-import com.cloud.utils.db.GenericDaoBase;
-import com.cloud.utils.db.GenericSearchBuilder;
-import com.cloud.utils.db.SearchBuilder;
-import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.db.SearchCriteria.Func;
-import com.cloud.utils.db.SearchCriteria.Op;
-
-public class NetworkOfferingDetailsDaoImpl extends GenericDaoBase<NetworkOfferingDetailsVO, Long> implements NetworkOfferingDetailsDao{
- protected final SearchBuilder<NetworkOfferingDetailsVO> DetailSearch;
- private final GenericSearchBuilder<NetworkOfferingDetailsVO, String> ValueSearch;
-
-
- public NetworkOfferingDetailsDaoImpl() {
-
- DetailSearch = createSearchBuilder();
- DetailSearch.and("offeringId", DetailSearch.entity().getOfferingId(), SearchCriteria.Op.EQ);
- DetailSearch.and("name", DetailSearch.entity().getName(), SearchCriteria.Op.EQ);
- DetailSearch.done();
-
- ValueSearch = createSearchBuilder(String.class);
- ValueSearch.select(null, Func.DISTINCT, ValueSearch.entity().getValue());
- ValueSearch.and("offeringId", ValueSearch.entity().getOfferingId(), SearchCriteria.Op.EQ);
- ValueSearch.and("name", ValueSearch.entity().getName(), Op.EQ);
- ValueSearch.done();
- }
-
- @Override
- public Map<NetworkOffering.Detail,String> getNtwkOffDetails(long offeringId) {
- SearchCriteria<NetworkOfferingDetailsVO> sc = DetailSearch.create();
- sc.setParameters("offeringId", offeringId);
-
- List<NetworkOfferingDetailsVO> results = search(sc, null);
- Map<NetworkOffering.Detail, String> details = new HashMap<NetworkOffering.Detail, String>(results.size());
- for (NetworkOfferingDetailsVO result : results) {
- details.put(result.getName(), result.getValue());
- }
-
- return details;
- }
-
- @Override
- public String getDetail(long offeringId, Detail detailName) {
- SearchCriteria<String> sc = ValueSearch.create();
- sc.setParameters("name", detailName);
- sc.setParameters("offeringId", offeringId);
- List<String> results = customSearch(sc, null);
- if (results.isEmpty()) {
- return null;
- } else {
- return results.get(0);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index 48924ef..3d7ad2e 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -93,16 +93,20 @@ import org.apache.cloudstack.api.command.admin.network.AddNetworkServiceProvider
import org.apache.cloudstack.api.command.admin.network.CreateNetworkOfferingCmd;
import org.apache.cloudstack.api.command.admin.network.CreatePhysicalNetworkCmd;
import org.apache.cloudstack.api.command.admin.network.CreateStorageNetworkIpRangeCmd;
+import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
import org.apache.cloudstack.api.command.admin.network.DeleteNetworkDeviceCmd;
import org.apache.cloudstack.api.command.admin.network.DeleteNetworkOfferingCmd;
import org.apache.cloudstack.api.command.admin.network.DeleteNetworkServiceProviderCmd;
import org.apache.cloudstack.api.command.admin.network.DeletePhysicalNetworkCmd;
import org.apache.cloudstack.api.command.admin.network.DeleteStorageNetworkIpRangeCmd;
+import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;
import org.apache.cloudstack.api.command.admin.network.ListNetworkDeviceCmd;
+import org.apache.cloudstack.api.command.admin.network.ListNetworkIsolationMethodsCmd;
import org.apache.cloudstack.api.command.admin.network.ListNetworkServiceProvidersCmd;
import org.apache.cloudstack.api.command.admin.network.ListPhysicalNetworksCmd;
import org.apache.cloudstack.api.command.admin.network.ListStorageNetworkIpRangeCmd;
import org.apache.cloudstack.api.command.admin.network.ListSupportedNetworkServicesCmd;
+import org.apache.cloudstack.api.command.admin.network.ReleaseDedicatedGuestVlanRangeCmd;
import org.apache.cloudstack.api.command.admin.network.UpdateNetworkOfferingCmd;
import org.apache.cloudstack.api.command.admin.network.UpdateNetworkServiceProviderCmd;
import org.apache.cloudstack.api.command.admin.network.UpdatePhysicalNetworkCmd;
@@ -358,6 +362,7 @@ import org.apache.cloudstack.api.command.user.vmgroup.UpdateVMGroupCmd;
import org.apache.cloudstack.api.command.user.vmsnapshot.CreateVMSnapshotCmd;
import org.apache.cloudstack.api.command.user.vmsnapshot.DeleteVMSnapshotCmd;
import org.apache.cloudstack.api.command.user.vmsnapshot.ListVMSnapshotCmd;
+import org.apache.cloudstack.api.command.user.vmsnapshot.RevertToVMSnapshotCmd;
import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd;
import org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd;
import org.apache.cloudstack.api.command.user.volume.DeleteVolumeCmd;
@@ -576,80 +581,6 @@ import com.cloud.vm.dao.VMInstanceDao;
import edu.emory.mathcs.backport.java.util.Arrays;
import edu.emory.mathcs.backport.java.util.Collections;
-import org.apache.cloudstack.acl.ControlledEntity;
-import org.apache.cloudstack.api.command.admin.autoscale.CreateCounterCmd;
-import org.apache.cloudstack.api.command.admin.autoscale.DeleteCounterCmd;
-import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd;
-import org.apache.cloudstack.api.command.admin.cluster.DeleteClusterCmd;
-import org.apache.cloudstack.api.command.admin.cluster.ListClustersCmd;
-import org.apache.cloudstack.api.command.admin.cluster.UpdateClusterCmd;
-import org.apache.cloudstack.api.command.admin.config.ListCfgsByCmd;
-import org.apache.cloudstack.api.command.admin.config.ListHypervisorCapabilitiesCmd;
-import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
-import org.apache.cloudstack.api.command.admin.config.UpdateHypervisorCapabilitiesCmd;
-import org.apache.cloudstack.api.command.admin.ldap.LDAPConfigCmd;
-import org.apache.cloudstack.api.command.admin.ldap.LDAPRemoveCmd;
-import org.apache.cloudstack.api.command.admin.pod.CreatePodCmd;
-import org.apache.cloudstack.api.command.admin.pod.DeletePodCmd;
-import org.apache.cloudstack.api.command.admin.pod.ListPodsByCmd;
-import org.apache.cloudstack.api.command.admin.pod.UpdatePodCmd;
-import org.apache.cloudstack.api.command.admin.region.AddRegionCmd;
-import org.apache.cloudstack.api.command.admin.region.RemoveRegionCmd;
-import org.apache.cloudstack.api.command.admin.region.UpdateRegionCmd;
-import org.apache.cloudstack.api.command.admin.swift.AddSwiftCmd;
-import org.apache.cloudstack.api.command.admin.swift.ListSwiftsCmd;
-import org.apache.cloudstack.api.command.admin.template.PrepareTemplateCmd;
-import org.apache.cloudstack.api.command.admin.vlan.CreateVlanIpRangeCmd;
-import org.apache.cloudstack.api.command.admin.vlan.DeleteVlanIpRangeCmd;
-import org.apache.cloudstack.api.command.admin.vlan.ListVlanIpRangesCmd;
-import org.apache.cloudstack.api.command.admin.vm.AssignVMCmd;
-import org.apache.cloudstack.api.command.admin.vm.MigrateVMCmd;
-import org.apache.cloudstack.api.command.admin.vm.MigrateVirtualMachineWithVolumeCmd;
-import org.apache.cloudstack.api.command.admin.vm.RecoverVMCmd;
-import org.apache.cloudstack.api.command.admin.zone.CreateZoneCmd;
-import org.apache.cloudstack.api.command.admin.zone.DeleteZoneCmd;
-import org.apache.cloudstack.api.command.admin.zone.MarkDefaultZoneForAccountCmd;
-import org.apache.cloudstack.api.command.admin.zone.UpdateZoneCmd;
-import org.apache.cloudstack.api.command.user.account.AddAccountToProjectCmd;
-import org.apache.cloudstack.api.command.user.account.DeleteAccountFromProjectCmd;
-import org.apache.cloudstack.api.command.user.account.ListAccountsCmd;
-import org.apache.cloudstack.api.command.user.account.ListProjectAccountsCmd;
-import org.apache.cloudstack.api.command.user.address.AssociateIPAddrCmd;
-import org.apache.cloudstack.api.command.user.address.DisassociateIPAddrCmd;
-import org.apache.cloudstack.api.command.user.address.ListPublicIpAddressesCmd;
-import org.apache.cloudstack.api.command.user.config.ListCapabilitiesCmd;
-import org.apache.cloudstack.api.command.user.event.ArchiveEventsCmd;
-import org.apache.cloudstack.api.command.user.event.DeleteEventsCmd;
-import org.apache.cloudstack.api.command.user.event.ListEventTypesCmd;
-import org.apache.cloudstack.api.command.user.event.ListEventsCmd;
-import org.apache.cloudstack.api.command.user.guest.ListGuestOsCategoriesCmd;
-import org.apache.cloudstack.api.command.user.guest.ListGuestOsCmd;
-import org.apache.cloudstack.api.command.user.job.ListAsyncJobsCmd;
-import org.apache.cloudstack.api.command.user.job.QueryAsyncJobResultCmd;
-import org.apache.cloudstack.api.command.user.offering.ListDiskOfferingsCmd;
-import org.apache.cloudstack.api.command.user.offering.ListServiceOfferingsCmd;
-import org.apache.cloudstack.api.command.user.region.ListRegionsCmd;
-import org.apache.cloudstack.api.command.user.region.ha.gslb.*;
-import org.apache.cloudstack.api.command.user.ssh.CreateSSHKeyPairCmd;
-import org.apache.cloudstack.api.command.user.ssh.DeleteSSHKeyPairCmd;
-import org.apache.cloudstack.api.command.user.ssh.ListSSHKeyPairsCmd;
-import org.apache.cloudstack.api.command.user.ssh.RegisterSSHKeyPairCmd;
-import org.apache.cloudstack.api.command.user.tag.CreateTagsCmd;
-import org.apache.cloudstack.api.command.user.tag.DeleteTagsCmd;
-import org.apache.cloudstack.api.command.user.tag.ListTagsCmd;
-import org.apache.cloudstack.api.command.user.vmgroup.CreateVMGroupCmd;
-import org.apache.cloudstack.api.command.user.vmgroup.DeleteVMGroupCmd;
-import org.apache.cloudstack.api.command.user.vmgroup.ListVMGroupsCmd;
-import org.apache.cloudstack.api.command.user.vmgroup.UpdateVMGroupCmd;
-import org.apache.cloudstack.api.command.user.vmsnapshot.CreateVMSnapshotCmd;
-import org.apache.cloudstack.api.command.user.vmsnapshot.DeleteVMSnapshotCmd;
-import org.apache.cloudstack.api.command.user.vmsnapshot.ListVMSnapshotCmd;
-import org.apache.cloudstack.api.command.user.vmsnapshot.RevertToVMSnapshotCmd;
-import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
-import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
-import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
-import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
public class ManagementServerImpl extends ManagerBase implements ManagementServer {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java b/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
index 5213626..ec0be8c 100644
--- a/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
+++ b/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerManagerImpl.java
@@ -26,7 +26,8 @@ import javax.inject.Inject;
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
import org.apache.cloudstack.api.command.user.loadbalancer.ListApplicationLoadBalancersCmd;
-import org.apache.cloudstack.network.lb.dao.ApplicationLoadBalancerRuleDao;
+import org.apache.cloudstack.lb.ApplicationLoadBalancerRuleVO;
+import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerRuleVO.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerRuleVO.java b/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerRuleVO.java
deleted file mode 100644
index b6cf98c..0000000
--- a/server/src/org/apache/cloudstack/network/lb/ApplicationLoadBalancerRuleVO.java
+++ /dev/null
@@ -1,131 +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 org.apache.cloudstack.network.lb;
-
-import javax.persistence.Column;
-import javax.persistence.DiscriminatorValue;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.PrimaryKeyJoinColumn;
-import javax.persistence.Table;
-
-import com.cloud.network.rules.FirewallRuleVO;
-import com.cloud.utils.net.Ip;
-import com.cloud.utils.net.NetUtils;
-
-/**
- * This VO represent Internal Load Balancer rule.
- * Instead of pointing to the public ip address id directly as External Load Balancer rule does, it refers to the ip address by its value/sourceNetworkid
- *
- */
-@Entity
-@Table(name=("load_balancing_rules"))
-@DiscriminatorValue(value="LoadBalancing")
-@PrimaryKeyJoinColumn(name="id")
-public class ApplicationLoadBalancerRuleVO extends FirewallRuleVO implements ApplicationLoadBalancerRule{
- @Column(name="name")
- private String name;
-
- @Column(name="description", length=4096)
- private String description;
-
- @Column(name="algorithm")
- private String algorithm;
-
- @Column(name="default_port_start")
- private int defaultPortStart;
-
- @Column(name="default_port_end")
- private int defaultPortEnd;
-
- @Column(name="source_ip_address_network_id")
- Long sourceIpNetworkId;
-
- @Column(name="source_ip_address")
- @Enumerated(value=EnumType.STRING)
- private Ip sourceIp = null;
-
- @Enumerated(value=EnumType.STRING)
- @Column(name="scheme")
- Scheme scheme;
-
-
- public ApplicationLoadBalancerRuleVO() {
- }
-
- public ApplicationLoadBalancerRuleVO(String name, String description, int srcPort, int instancePort, String algorithm,
- long networkId, long accountId, long domainId, Ip sourceIp, long sourceIpNtwkId, Scheme scheme) {
- super(null, null, srcPort, srcPort, NetUtils.TCP_PROTO, networkId, accountId, domainId, Purpose.LoadBalancing, null, null,null, null, null);
-
- this.name = name;
- this.description = description;
- this.algorithm = algorithm;
- this.defaultPortStart = instancePort;
- this.defaultPortEnd = instancePort;
- this.sourceIp = sourceIp;
- this.sourceIpNetworkId = sourceIpNtwkId;
- this.scheme = scheme;
- }
-
-
- @Override
- public Long getSourceIpNetworkId() {
- return sourceIpNetworkId;
- }
-
- @Override
- public Ip getSourceIp() {
- return sourceIp;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public String getDescription() {
- return description;
- }
-
- @Override
- public String getAlgorithm() {
- return algorithm;
- }
-
- @Override
- public int getDefaultPortStart() {
- return defaultPortStart;
- }
-
- @Override
- public int getDefaultPortEnd() {
- return defaultPortEnd;
- }
-
- @Override
- public Scheme getScheme() {
- return scheme;
- }
-
- @Override
- public int getInstancePort() {
- return defaultPortStart;
- }
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/server/src/org/apache/cloudstack/network/lb/dao/ApplicationLoadBalancerRuleDao.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/network/lb/dao/ApplicationLoadBalancerRuleDao.java b/server/src/org/apache/cloudstack/network/lb/dao/ApplicationLoadBalancerRuleDao.java
deleted file mode 100644
index a3ba53e..0000000
--- a/server/src/org/apache/cloudstack/network/lb/dao/ApplicationLoadBalancerRuleDao.java
+++ /dev/null
@@ -1,35 +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 org.apache.cloudstack.network.lb.dao;
-
-import java.util.List;
-
-import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRuleVO;
-
-import com.cloud.network.rules.LoadBalancerContainer.Scheme;
-import com.cloud.utils.db.GenericDao;
-import com.cloud.utils.net.Ip;
-
-public interface ApplicationLoadBalancerRuleDao extends GenericDao<ApplicationLoadBalancerRuleVO, Long>{
- List<ApplicationLoadBalancerRuleVO> listBySrcIpSrcNtwkId(Ip sourceIp, long sourceNetworkId);
- List<String> listLbIpsBySourceIpNetworkId(long sourceIpNetworkId);
- long countBySourceIp(Ip sourceIp, long sourceIpNetworkId);
- List<ApplicationLoadBalancerRuleVO> listBySourceIpAndNotRevoked(Ip sourceIp, long sourceNetworkId);
- List<String> listLbIpsBySourceIpNetworkIdAndScheme(long sourceIpNetworkId, Scheme scheme);
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/server/src/org/apache/cloudstack/network/lb/dao/ApplicationLoadBalancerRuleDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/network/lb/dao/ApplicationLoadBalancerRuleDaoImpl.java b/server/src/org/apache/cloudstack/network/lb/dao/ApplicationLoadBalancerRuleDaoImpl.java
deleted file mode 100644
index 5caf06a..0000000
--- a/server/src/org/apache/cloudstack/network/lb/dao/ApplicationLoadBalancerRuleDaoImpl.java
+++ /dev/null
@@ -1,115 +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 org.apache.cloudstack.network.lb.dao;
-
-import java.util.List;
-
-import javax.ejb.Local;
-
-import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRuleVO;
-import org.springframework.stereotype.Component;
-
-import com.cloud.network.rules.FirewallRule;
-import com.cloud.network.rules.LoadBalancerContainer.Scheme;
-import com.cloud.utils.db.GenericDaoBase;
-import com.cloud.utils.db.GenericSearchBuilder;
-import com.cloud.utils.db.SearchBuilder;
-import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.db.SearchCriteria.Func;
-import com.cloud.utils.db.SearchCriteria.Op;
-import com.cloud.utils.net.Ip;
-
-@Component
-@Local(value = { ApplicationLoadBalancerRuleDao.class })
-public class ApplicationLoadBalancerRuleDaoImpl extends GenericDaoBase<ApplicationLoadBalancerRuleVO, Long> implements ApplicationLoadBalancerRuleDao{
- protected final SearchBuilder<ApplicationLoadBalancerRuleVO> AllFieldsSearch;
- final GenericSearchBuilder<ApplicationLoadBalancerRuleVO, String> listIps;
- final GenericSearchBuilder<ApplicationLoadBalancerRuleVO, Long> CountBy;
- protected final SearchBuilder<ApplicationLoadBalancerRuleVO> NotRevokedSearch;
-
-
-
- protected ApplicationLoadBalancerRuleDaoImpl() {
- AllFieldsSearch = createSearchBuilder();
- AllFieldsSearch.and("sourceIp", AllFieldsSearch.entity().getSourceIp(), SearchCriteria.Op.EQ);
- AllFieldsSearch.and("sourceIpNetworkId", AllFieldsSearch.entity().getSourceIpNetworkId(), SearchCriteria.Op.EQ);
- AllFieldsSearch.and("networkId", AllFieldsSearch.entity().getNetworkId(), SearchCriteria.Op.EQ);
- AllFieldsSearch.and("scheme", AllFieldsSearch.entity().getScheme(), SearchCriteria.Op.EQ);
- AllFieldsSearch.done();
-
- listIps = createSearchBuilder(String.class);
- listIps.select(null, Func.DISTINCT, listIps.entity().getSourceIp());
- listIps.and("sourceIpNetworkId", listIps.entity().getSourceIpNetworkId(), Op.EQ);
- listIps.and("scheme", listIps.entity().getScheme(), Op.EQ);
- listIps.done();
-
- CountBy = createSearchBuilder(Long.class);
- CountBy.select(null, Func.COUNT, CountBy.entity().getId());
- CountBy.and("sourceIp", CountBy.entity().getSourceIp(), Op.EQ);
- CountBy.and("sourceIpNetworkId", CountBy.entity().getSourceIpNetworkId(), Op.EQ);
- CountBy.done();
-
- NotRevokedSearch = createSearchBuilder();
- NotRevokedSearch.and("sourceIp", NotRevokedSearch.entity().getSourceIp(), SearchCriteria.Op.EQ);
- NotRevokedSearch.and("sourceIpNetworkId", NotRevokedSearch.entity().getSourceIpNetworkId(), SearchCriteria.Op.EQ);
- NotRevokedSearch.and("state", NotRevokedSearch.entity().getState(), SearchCriteria.Op.NEQ);
- NotRevokedSearch.done();
- }
-
- @Override
- public List<ApplicationLoadBalancerRuleVO> listBySrcIpSrcNtwkId(Ip sourceIp, long sourceNetworkId) {
- SearchCriteria<ApplicationLoadBalancerRuleVO> sc = AllFieldsSearch.create();
- sc.setParameters("sourceIp", sourceIp);
- sc.setParameters("sourceIpNetworkId", sourceNetworkId);
- return listBy(sc);
- }
-
- @Override
- public List<String> listLbIpsBySourceIpNetworkId(long sourceIpNetworkId) {
- SearchCriteria<String> sc = listIps.create();
- sc.setParameters("sourceIpNetworkId", sourceIpNetworkId);
- return customSearch(sc, null);
- }
-
- @Override
- public long countBySourceIp(Ip sourceIp, long sourceIpNetworkId) {
- SearchCriteria<Long> sc = CountBy.create();
- sc.setParameters("sourceIp", sourceIp);
- sc.setParameters("sourceIpNetworkId", sourceIpNetworkId);
- List<Long> results = customSearch(sc, null);
- return results.get(0);
- }
-
- @Override
- public List<ApplicationLoadBalancerRuleVO> listBySourceIpAndNotRevoked(Ip sourceIp, long sourceNetworkId) {
- SearchCriteria<ApplicationLoadBalancerRuleVO> sc = NotRevokedSearch.create();
- sc.setParameters("sourceIp", sourceIp);
- sc.setParameters("sourceIpNetworkId", sourceNetworkId);
- sc.setParameters("state", FirewallRule.State.Revoke);
- return listBy(sc);
- }
-
- @Override
- public List<String> listLbIpsBySourceIpNetworkIdAndScheme(long sourceIpNetworkId, Scheme scheme) {
- SearchCriteria<String> sc = listIps.create();
- sc.setParameters("sourceIpNetworkId", sourceIpNetworkId);
- sc.setParameters("scheme", scheme);
- return customSearch(sc, null);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
index b6d16a1..b530566 100644
--- a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
+++ b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
@@ -25,6 +25,8 @@ import javax.inject.Inject;
import javax.naming.ConfigurationException;
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
+import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
+import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;
import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd;
import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
@@ -45,6 +47,7 @@ import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InsufficientVirtualNetworkCapcityException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.GuestVlan;
import com.cloud.network.IpAddress;
import com.cloud.network.Network;
import com.cloud.network.Network.Provider;
@@ -59,7 +62,6 @@ import com.cloud.network.PhysicalNetworkServiceProvider;
import com.cloud.network.PhysicalNetworkTrafficType;
import com.cloud.network.PublicIpAddress;
import com.cloud.network.addr.PublicIp;
-import com.cloud.network.dao.AccountGuestVlanMapVO;
import com.cloud.network.dao.IPAddressVO;
import com.cloud.network.dao.NetworkServiceMapDao;
import com.cloud.network.dao.NetworkVO;
@@ -80,26 +82,15 @@ import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.utils.Pair;
import com.cloud.utils.component.ManagerBase;
-import com.cloud.vm.*;
+import com.cloud.vm.Nic;
+import com.cloud.vm.NicProfile;
+import com.cloud.vm.NicSecondaryIp;
+import com.cloud.vm.NicVO;
+import com.cloud.vm.ReservationContext;
+import com.cloud.vm.VMInstanceVO;
+import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachine.Type;
import com.cloud.vm.VirtualMachineProfile;
-import org.apache.cloudstack.acl.ControlledEntity.ACLType;
-import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
-import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;
-import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
-import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd;
-import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
-import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
-import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-
-import javax.ejb.Local;
-import javax.inject.Inject;
-import javax.naming.ConfigurationException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
@Component
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/server/test/org/apache/cloudstack/lb/ApplicationLoadBalancerTest.java
----------------------------------------------------------------------
diff --git a/server/test/org/apache/cloudstack/lb/ApplicationLoadBalancerTest.java b/server/test/org/apache/cloudstack/lb/ApplicationLoadBalancerTest.java
index 235cec6..461cbbd 100644
--- a/server/test/org/apache/cloudstack/lb/ApplicationLoadBalancerTest.java
+++ b/server/test/org/apache/cloudstack/lb/ApplicationLoadBalancerTest.java
@@ -24,10 +24,9 @@ import javax.inject.Inject;
import junit.framework.TestCase;
+import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao;
import org.apache.cloudstack.network.lb.ApplicationLoadBalancerManagerImpl;
import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
-import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRuleVO;
-import org.apache.cloudstack.network.lb.dao.ApplicationLoadBalancerRuleDao;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43e1667f/server/test/org/apache/cloudstack/lb/ChildTestConfiguration.java
----------------------------------------------------------------------
diff --git a/server/test/org/apache/cloudstack/lb/ChildTestConfiguration.java b/server/test/org/apache/cloudstack/lb/ChildTestConfiguration.java
index 60dfb6e..918de81 100644
--- a/server/test/org/apache/cloudstack/lb/ChildTestConfiguration.java
+++ b/server/test/org/apache/cloudstack/lb/ChildTestConfiguration.java
@@ -18,7 +18,8 @@ package org.apache.cloudstack.lb;
import java.io.IOException;
-import org.apache.cloudstack.network.lb.dao.ApplicationLoadBalancerRuleDao;
+import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao;
+import org.apache.cloudstack.test.utils.SpringUtils;
import org.mockito.Mockito;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@@ -37,7 +38,6 @@ import com.cloud.network.dao.FirewallRulesDao;
import com.cloud.network.lb.LoadBalancingRulesManager;
import com.cloud.tags.dao.ResourceTagDao;
import com.cloud.user.AccountManager;
-import com.cloud.utils.component.SpringComponentScanUtils;
@Configuration
@ComponentScan(
@@ -96,7 +96,7 @@ import com.cloud.utils.component.SpringComponentScanUtils;
public boolean match(MetadataReader mdr, MetadataReaderFactory arg1) throws IOException {
mdr.getClassMetadata().getClassName();
ComponentScan cs = ChildTestConfiguration.class.getAnnotation(ComponentScan.class);
- return SpringComponentScanUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
+ return SpringUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
}
}