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 AB18710537 for ; Wed, 8 May 2013 17:48:33 +0000 (UTC) Received: (qmail 40643 invoked by uid 500); 8 May 2013 17:48:26 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 40572 invoked by uid 500); 8 May 2013 17:48:26 -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 40270 invoked by uid 99); 8 May 2013 17:48:26 -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 17:48:26 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id C609C889D79; Wed, 8 May 2013 17:48:25 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bfederle@apache.org To: commits@cloudstack.apache.org Date: Wed, 08 May 2013 17:48:32 -0000 Message-Id: <45c3c944b01248fca602b5b2b0bbc8d6@git.apache.org> In-Reply-To: <818559ec26454aa7b9803739214b1b22@git.apache.org> References: <818559ec26454aa7b9803739214b1b22@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [08/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/dao/RemoteAccessVpnDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/RemoteAccessVpnDaoImpl.java b/server/src/com/cloud/network/dao/RemoteAccessVpnDaoImpl.java deleted file mode 100644 index ed732d8..0000000 --- a/server/src/com/cloud/network/dao/RemoteAccessVpnDaoImpl.java +++ /dev/null @@ -1,84 +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.apache.log4j.Logger; -import org.springframework.stereotype.Component; - -import com.cloud.network.RemoteAccessVpn; -import com.cloud.utils.db.GenericDaoBase; -import com.cloud.utils.db.SearchBuilder; -import com.cloud.utils.db.SearchCriteria; - -@Component -@Local(value={RemoteAccessVpnDao.class}) -public class RemoteAccessVpnDaoImpl extends GenericDaoBase implements RemoteAccessVpnDao { - private static final Logger s_logger = Logger.getLogger(RemoteAccessVpnDaoImpl.class); - - private final SearchBuilder AllFieldsSearch; - - - protected RemoteAccessVpnDaoImpl() { - AllFieldsSearch = createSearchBuilder(); - AllFieldsSearch.and("accountId", AllFieldsSearch.entity().getAccountId(), SearchCriteria.Op.EQ); - AllFieldsSearch.and("networkId", AllFieldsSearch.entity().getNetworkId(), SearchCriteria.Op.EQ); - AllFieldsSearch.and("ipAddress", AllFieldsSearch.entity().getServerAddressId(), SearchCriteria.Op.EQ); - AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), SearchCriteria.Op.EQ); - AllFieldsSearch.done(); - } - - @Override - public RemoteAccessVpnVO findByPublicIpAddress(long ipAddressId) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("ipAddress", ipAddressId); - return findOneBy(sc); - } - - @Override - public RemoteAccessVpnVO findByAccountAndNetwork(Long accountId, Long networkId) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("accountId", accountId); - sc.setParameters("networkId", networkId); - return findOneBy(sc); - } - - @Override - public List findByAccount(Long accountId) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("accountId", accountId); - return listBy(sc); - } - - @Override - public RemoteAccessVpnVO findByPublicIpAddressAndState(long ipAddressId, RemoteAccessVpn.State state) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("ipAddress", ipAddressId); - sc.setParameters("state", state); - return findOneBy(sc); - } - - @Override - public List listByNetworkId(Long networkId) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("networkId", networkId); - return listBy(sc); - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/RemoteAccessVpnVO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/RemoteAccessVpnVO.java b/server/src/com/cloud/network/dao/RemoteAccessVpnVO.java deleted file mode 100644 index 2e8ee91..0000000 --- a/server/src/com/cloud/network/dao/RemoteAccessVpnVO.java +++ /dev/null @@ -1,142 +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.UUID; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -import com.cloud.network.RemoteAccessVpn; - -@Entity -@Table(name=("remote_access_vpn")) -public class RemoteAccessVpnVO implements RemoteAccessVpn { - @Column(name="account_id") - private long accountId; - - @Column(name="network_id") - private long networkId; - - @Column(name="domain_id") - private long domainId; - - @Column(name="vpn_server_addr_id") - private long serverAddressId; - - @Column(name="local_ip") - private String localIp; - - @Column(name="ip_range") - private String ipRange; - - @Column(name="ipsec_psk") - private String ipsecPresharedKey; - - @Column(name="state") - private State state; - - @Id - @GeneratedValue(strategy=GenerationType.IDENTITY) - @Column(name="id") - private long id; - - @Column(name="uuid") - private String uuid; - - public RemoteAccessVpnVO() { - this.uuid = UUID.randomUUID().toString(); - } - - public RemoteAccessVpnVO(long accountId, long domainId, long networkId, long publicIpId, String localIp, String ipRange, String presharedKey) { - this.accountId = accountId; - this.serverAddressId = publicIpId; - this.ipRange = ipRange; - this.ipsecPresharedKey = presharedKey; - this.localIp = localIp; - this.domainId = domainId; - this.networkId = networkId; - this.state = State.Added; - this.uuid = UUID.randomUUID().toString(); - } - - @Override - public State getState() { - return state; - } - - public void setState(State state) { - this.state = state; - } - - @Override - public long getAccountId() { - return accountId; - } - - @Override - public long getServerAddressId() { - return serverAddressId; - } - - @Override - public String getIpRange() { - return ipRange; - } - - public void setIpRange(String ipRange) { - this.ipRange = ipRange; - } - - @Override - public String getIpsecPresharedKey() { - return ipsecPresharedKey; - } - - public void setIpsecPresharedKey(String ipsecPresharedKey) { - this.ipsecPresharedKey = ipsecPresharedKey; - } - - @Override - public String getLocalIp() { - return localIp; - } - - @Override - public long getDomainId() { - return domainId; - } - - @Override - public long getNetworkId() { - return networkId; - } - - @Override - public long getId() { - return id; - } - - @Override - public String getUuid() { - return uuid; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/RouterNetworkDao.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/RouterNetworkDao.java b/server/src/com/cloud/network/dao/RouterNetworkDao.java deleted file mode 100644 index bd275bd..0000000 --- a/server/src/com/cloud/network/dao/RouterNetworkDao.java +++ /dev/null @@ -1,26 +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 RouterNetworkDao extends GenericDao { - public List getRouterNetworks(long routerId); - public RouterNetworkVO findByRouterAndNetwork (long routerId, long networkId); -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/RouterNetworkDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/RouterNetworkDaoImpl.java b/server/src/com/cloud/network/dao/RouterNetworkDaoImpl.java deleted file mode 100644 index b0b633c..0000000 --- a/server/src/com/cloud/network/dao/RouterNetworkDaoImpl.java +++ /dev/null @@ -1,62 +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 org.springframework.stereotype.Component; - -import com.cloud.utils.db.GenericDao; -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.Op; - -@Component -public class RouterNetworkDaoImpl extends GenericDaoBase implements RouterNetworkDao { - protected final GenericSearchBuilder RouterNetworksSearch; - protected final SearchBuilder AllFieldsSearch; - - public RouterNetworkDaoImpl() { - super(); - - RouterNetworksSearch = createSearchBuilder(Long.class); - RouterNetworksSearch.selectField(RouterNetworksSearch.entity().getNetworkId()); - RouterNetworksSearch.and("routerId", RouterNetworksSearch.entity().getRouterId(), Op.EQ); - RouterNetworksSearch.done(); - - AllFieldsSearch = createSearchBuilder(); - AllFieldsSearch.and("routerId", AllFieldsSearch.entity().getRouterId(), Op.EQ); - AllFieldsSearch.and("networkId", AllFieldsSearch.entity().getNetworkId(), Op.EQ); - AllFieldsSearch.done(); - } - - public List getRouterNetworks(long routerId) { - SearchCriteria sc = RouterNetworksSearch.create(); - sc.setParameters("routerId", routerId); - return customSearch(sc, null); - } - - public RouterNetworkVO findByRouterAndNetwork (long routerId, long networkId) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("routerId", routerId); - sc.setParameters("networkId", networkId); - return findOneBy(sc); - } - -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/RouterNetworkVO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/RouterNetworkVO.java b/server/src/com/cloud/network/dao/RouterNetworkVO.java deleted file mode 100644 index c4fe9a5..0000000 --- a/server/src/com/cloud/network/dao/RouterNetworkVO.java +++ /dev/null @@ -1,75 +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 javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -import com.cloud.network.Network; -import com.cloud.network.Network.GuestType; -import org.apache.cloudstack.api.InternalIdentity; - - -@Entity -@Table(name="router_network_ref") -public class RouterNetworkVO implements InternalIdentity { - @Id - @GeneratedValue(strategy=GenerationType.IDENTITY) - long id; - - @Column(name="router_id") - long routerId; - - @Column(name="network_id") - long networkId; - - @Column(name="guest_type") - @Enumerated(value=EnumType.STRING) - Network.GuestType guestType; - - protected RouterNetworkVO() { - } - - public RouterNetworkVO(long routerId, long networkId, GuestType guestType) { - this.networkId = networkId; - this.routerId = routerId; - this.guestType = guestType; - } - - - public long getRouterId() { - return routerId; - } - - public long getNetworkId() { - return networkId; - } - - public Network.GuestType getGuestType() { - return guestType; - } - - public long getId() { - return id; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/Site2SiteCustomerGatewayDao.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/Site2SiteCustomerGatewayDao.java b/server/src/com/cloud/network/dao/Site2SiteCustomerGatewayDao.java deleted file mode 100644 index 20ef12d..0000000 --- a/server/src/com/cloud/network/dao/Site2SiteCustomerGatewayDao.java +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.network.dao; - -import java.util.List; - -import com.cloud.utils.db.GenericDao; - -public interface Site2SiteCustomerGatewayDao extends GenericDao { - Site2SiteCustomerGatewayVO findByGatewayIp(String ip); - Site2SiteCustomerGatewayVO findByNameAndAccountId(String name, long accountId); - List listByAccountId(long accountId); -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/Site2SiteCustomerGatewayDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/Site2SiteCustomerGatewayDaoImpl.java b/server/src/com/cloud/network/dao/Site2SiteCustomerGatewayDaoImpl.java deleted file mode 100644 index fcb533a..0000000 --- a/server/src/com/cloud/network/dao/Site2SiteCustomerGatewayDaoImpl.java +++ /dev/null @@ -1,66 +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.apache.log4j.Logger; -import org.springframework.stereotype.Component; - -import com.cloud.utils.db.GenericDaoBase; -import com.cloud.utils.db.SearchBuilder; -import com.cloud.utils.db.SearchCriteria; - -@Component -@Local(value={Site2SiteCustomerGatewayDao.class}) -public class Site2SiteCustomerGatewayDaoImpl extends GenericDaoBase implements Site2SiteCustomerGatewayDao { - private static final Logger s_logger = Logger.getLogger(Site2SiteCustomerGatewayDaoImpl.class); - - private final SearchBuilder AllFieldsSearch; - - protected Site2SiteCustomerGatewayDaoImpl() { - AllFieldsSearch = createSearchBuilder(); - AllFieldsSearch.and("gatewayIp", AllFieldsSearch.entity().getGatewayIp(), SearchCriteria.Op.EQ); - AllFieldsSearch.and("name", AllFieldsSearch.entity().getName(), SearchCriteria.Op.EQ); - AllFieldsSearch.and("accountId", AllFieldsSearch.entity().getAccountId(), SearchCriteria.Op.EQ); - AllFieldsSearch.done(); - } - - @Override - public Site2SiteCustomerGatewayVO findByGatewayIp(String ip) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("gatewayIp", ip); - return findOneBy(sc); - } - - @Override - public Site2SiteCustomerGatewayVO findByNameAndAccountId(String name, long accountId) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("name", name); - sc.setParameters("accountId", accountId); - return findOneBy(sc); - } - - @Override - public List listByAccountId(long accountId) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("accountId", accountId); - return listBy(sc, null); - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/Site2SiteCustomerGatewayVO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/Site2SiteCustomerGatewayVO.java b/server/src/com/cloud/network/dao/Site2SiteCustomerGatewayVO.java deleted file mode 100644 index 80130ef..0000000 --- a/server/src/com/cloud/network/dao/Site2SiteCustomerGatewayVO.java +++ /dev/null @@ -1,206 +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.Date; -import java.util.UUID; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -import com.cloud.network.Site2SiteCustomerGateway; -import com.cloud.utils.db.GenericDao; -import org.apache.cloudstack.api.InternalIdentity; - -@Entity -@Table(name=("s2s_customer_gateway")) -public class Site2SiteCustomerGatewayVO implements Site2SiteCustomerGateway { - @Id - @GeneratedValue(strategy=GenerationType.IDENTITY) - @Column(name="id") - private long id; - - @Column(name="uuid") - private String uuid; - - @Column(name="name") - private String name; - - @Column(name="gateway_ip") - private String gatewayIp; - - @Column(name="guest_cidr_list") - private String guestCidrList; - - @Column(name="ipsec_psk") - private String ipsecPsk; - - @Column(name="ike_policy") - private String ikePolicy; - - @Column(name="esp_policy") - private String espPolicy; - - @Column(name="ike_lifetime") - private long ikeLifetime; - - @Column(name="esp_lifetime") - private long espLifetime; - - @Column(name="dpd") - private boolean dpd; - - @Column(name="domain_id") - private Long domainId; - - @Column(name="account_id") - private Long accountId; - - @Column(name=GenericDao.REMOVED_COLUMN) - private Date removed; - - public Site2SiteCustomerGatewayVO() { } - - public Site2SiteCustomerGatewayVO(String name, long accountId, long domainId, String gatewayIp, String guestCidrList, String ipsecPsk, String ikePolicy, String espPolicy, - long ikeLifetime, long espLifetime, boolean dpd) { - this.name = name; - this.gatewayIp = gatewayIp; - this.guestCidrList = guestCidrList; - this.ipsecPsk = ipsecPsk; - this.ikePolicy = ikePolicy; - this.espPolicy = espPolicy; - this.ikeLifetime = ikeLifetime; - this.espLifetime = espLifetime; - this.dpd = dpd; - this.uuid = UUID.randomUUID().toString(); - this.accountId = accountId; - this.domainId = domainId; - } - - @Override - public long getId() { - return id; - } - - @Override - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - @Override - public String getGatewayIp() { - return gatewayIp; - } - - public void setGatewayIp(String gatewayIp) { - this.gatewayIp = gatewayIp; - } - - @Override - public String getGuestCidrList() { - return guestCidrList; - } - - public void setGuestCidrList(String guestCidrList) { - this.guestCidrList = guestCidrList; - } - - @Override - public String getIpsecPsk() { - return ipsecPsk; - } - - public void setIpsecPsk(String ipsecPsk) { - this.ipsecPsk = ipsecPsk; - } - - @Override - public Date getRemoved() { - return removed; - } - - public void setRemoved(Date removed) { - this.removed = removed; - } - - @Override - public Long getIkeLifetime() { - return ikeLifetime; - } - - public void setIkeLifetime(long ikeLifetime) { - this.ikeLifetime = ikeLifetime; - } - - @Override - public Long getEspLifetime() { - return espLifetime; - } - - public void setEspLifetime(long espLifetime) { - this.espLifetime = espLifetime; - } - - @Override - public String getIkePolicy() { - return ikePolicy; - } - - public void setIkePolicy(String ikePolicy) { - this.ikePolicy = ikePolicy; - } - - @Override - public String getEspPolicy() { - return espPolicy; - } - - public void setEspPolicy(String espPolicy) { - this.espPolicy = espPolicy; - } - - @Override - public Boolean getDpd() { - return dpd; - } - - public void setDpd(boolean dpd) { - this.dpd = dpd; - } - - public String getUuid() { - return uuid; - } - - @Override - public long getDomainId() { - return domainId; - } - - @Override - public long getAccountId() { - return accountId; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/Site2SiteVpnConnectionDao.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/Site2SiteVpnConnectionDao.java b/server/src/com/cloud/network/dao/Site2SiteVpnConnectionDao.java deleted file mode 100644 index 66d5a4a..0000000 --- a/server/src/com/cloud/network/dao/Site2SiteVpnConnectionDao.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 Site2SiteVpnConnectionDao extends GenericDao { - List listByCustomerGatewayId(long id); - List listByVpnGatewayId(long id); - List listByVpcId(long vpcId); - Site2SiteVpnConnectionVO findByVpnGatewayIdAndCustomerGatewayId(long vpnId, long customerId); - Site2SiteVpnConnectionVO findByCustomerGatewayId(long customerId); -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/Site2SiteVpnConnectionDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/Site2SiteVpnConnectionDaoImpl.java b/server/src/com/cloud/network/dao/Site2SiteVpnConnectionDaoImpl.java deleted file mode 100644 index 4745f9a..0000000 --- a/server/src/com/cloud/network/dao/Site2SiteVpnConnectionDaoImpl.java +++ /dev/null @@ -1,97 +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.annotation.PostConstruct; -import javax.ejb.Local; -import javax.inject.Inject; - -import org.apache.log4j.Logger; -import org.springframework.stereotype.Component; - -import com.cloud.utils.db.GenericDaoBase; -import com.cloud.utils.db.JoinBuilder.JoinType; -import com.cloud.utils.db.SearchBuilder; -import com.cloud.utils.db.SearchCriteria; - -@Component -@Local(value={Site2SiteVpnConnectionDao.class}) -public class Site2SiteVpnConnectionDaoImpl extends GenericDaoBase implements Site2SiteVpnConnectionDao { - private static final Logger s_logger = Logger.getLogger(Site2SiteVpnConnectionDaoImpl.class); - - @Inject protected IPAddressDao _addrDao; - @Inject protected Site2SiteVpnGatewayDao _vpnGatewayDao; - - private SearchBuilder AllFieldsSearch; - private SearchBuilder VpcSearch; - private SearchBuilder VpnGatewaySearch; - - public Site2SiteVpnConnectionDaoImpl() { - } - - @PostConstruct - protected void init() { - AllFieldsSearch = createSearchBuilder(); - AllFieldsSearch.and("customerGatewayId", AllFieldsSearch.entity().getCustomerGatewayId(), SearchCriteria.Op.EQ); - AllFieldsSearch.and("vpnGatewayId", AllFieldsSearch.entity().getVpnGatewayId(), SearchCriteria.Op.EQ); - AllFieldsSearch.done(); - - VpcSearch = createSearchBuilder(); - VpnGatewaySearch = _vpnGatewayDao.createSearchBuilder(); - VpnGatewaySearch.and("vpcId", VpnGatewaySearch.entity().getVpcId(), SearchCriteria.Op.EQ); - VpcSearch.join("vpnGatewaySearch", VpnGatewaySearch, VpnGatewaySearch.entity().getId(), VpcSearch.entity().getVpnGatewayId(), JoinType.INNER); - VpcSearch.done(); - } - - @Override - public List listByCustomerGatewayId(long id) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("customerGatewayId", id); - return listBy(sc); - } - - @Override - public List listByVpnGatewayId(long id) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("vpnGatewayId", id); - return listBy(sc); - } - - @Override - public List listByVpcId(long vpcId) { - SearchCriteria sc = VpcSearch.create(); - sc.setJoinParameters("vpnGatewaySearch", "vpcId", vpcId); - return listBy(sc); - } - - @Override - public Site2SiteVpnConnectionVO findByVpnGatewayIdAndCustomerGatewayId(long vpnId, long customerId) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("vpnGatewayId", vpnId); - sc.setParameters("customerGatewayId", customerId); - return findOneBy(sc); - } - - @Override - public Site2SiteVpnConnectionVO findByCustomerGatewayId(long customerId) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("customerGatewayId", customerId); - return findOneBy(sc); - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/Site2SiteVpnConnectionVO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/Site2SiteVpnConnectionVO.java b/server/src/com/cloud/network/dao/Site2SiteVpnConnectionVO.java deleted file mode 100644 index f8eeb8a..0000000 --- a/server/src/com/cloud/network/dao/Site2SiteVpnConnectionVO.java +++ /dev/null @@ -1,143 +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.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 com.cloud.network.Site2SiteVpnConnection; -import com.cloud.network.Site2SiteVpnConnection.State; -import com.cloud.utils.db.GenericDao; -import org.apache.cloudstack.api.InternalIdentity; - -@Entity -@Table(name=("s2s_vpn_connection")) -public class Site2SiteVpnConnectionVO implements Site2SiteVpnConnection, InternalIdentity { - @Id - @GeneratedValue(strategy=GenerationType.IDENTITY) - @Column(name="id") - private long id; - - @Column(name="uuid") - private String uuid; - - @Column(name="vpn_gateway_id") - private long vpnGatewayId; - - @Column(name="customer_gateway_id") - private long customerGatewayId; - - @Column(name="state") - @Enumerated(value=EnumType.STRING) - private State state; - - @Column(name="domain_id") - private Long domainId; - - @Column(name="account_id") - private Long accountId; - - @Column(name=GenericDao.CREATED_COLUMN) - private Date created; - - @Column(name=GenericDao.REMOVED_COLUMN) - private Date removed; - - public Site2SiteVpnConnectionVO() { } - - public Site2SiteVpnConnectionVO(long accountId, long domainId, long vpnGatewayId, long customerGatewayId) { - this.uuid = UUID.randomUUID().toString(); - this.setVpnGatewayId(vpnGatewayId); - this.setCustomerGatewayId(customerGatewayId); - this.setState(State.Pending); - this.accountId = accountId; - this.domainId = domainId; - } - - @Override - public long getId() { - return id; - } - - @Override - public State getState() { - return state; - } - - public void setState(State state) { - this.state = state; - } - - @Override - public long getVpnGatewayId() { - return vpnGatewayId; - } - - public void setVpnGatewayId(long vpnGatewayId) { - this.vpnGatewayId = vpnGatewayId; - } - - @Override - public long getCustomerGatewayId() { - return customerGatewayId; - } - - public void setCustomerGatewayId(long customerGatewayId) { - this.customerGatewayId = customerGatewayId; - } - - @Override - public Date getCreated() { - return created; - } - - public void setCreated(Date created) { - this.created = created; - } - - @Override - public Date getRemoved() { - return removed; - } - - public void setRemoved(Date removed) { - this.removed = removed; - } - - public String getUuid() { - return uuid; - } - - @Override - public long getDomainId() { - return domainId; - } - - @Override - public long getAccountId() { - return accountId; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/Site2SiteVpnGatewayDao.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/Site2SiteVpnGatewayDao.java b/server/src/com/cloud/network/dao/Site2SiteVpnGatewayDao.java deleted file mode 100644 index 9b393e6..0000000 --- a/server/src/com/cloud/network/dao/Site2SiteVpnGatewayDao.java +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.network.dao; - -import com.cloud.utils.db.GenericDao; - -public interface Site2SiteVpnGatewayDao extends GenericDao { - Site2SiteVpnGatewayVO findByVpcId(long vpcId); -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/Site2SiteVpnGatewayDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/Site2SiteVpnGatewayDaoImpl.java b/server/src/com/cloud/network/dao/Site2SiteVpnGatewayDaoImpl.java deleted file mode 100644 index fa4a9fa..0000000 --- a/server/src/com/cloud/network/dao/Site2SiteVpnGatewayDaoImpl.java +++ /dev/null @@ -1,50 +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 javax.ejb.Local; -import javax.inject.Inject; - -import org.apache.log4j.Logger; -import org.springframework.stereotype.Component; - -import com.cloud.utils.db.GenericDaoBase; -import com.cloud.utils.db.SearchBuilder; -import com.cloud.utils.db.SearchCriteria; - -@Component -@Local(value={Site2SiteVpnGatewayDao.class}) -public class Site2SiteVpnGatewayDaoImpl extends GenericDaoBase implements Site2SiteVpnGatewayDao { - @Inject protected IPAddressDao _addrDao; - - private static final Logger s_logger = Logger.getLogger(Site2SiteVpnGatewayDaoImpl.class); - - private final SearchBuilder AllFieldsSearch; - - protected Site2SiteVpnGatewayDaoImpl() { - AllFieldsSearch = createSearchBuilder(); - AllFieldsSearch.and("vpcId", AllFieldsSearch.entity().getVpcId(), SearchCriteria.Op.EQ); - AllFieldsSearch.done(); - } - - @Override - public Site2SiteVpnGatewayVO findByVpcId(long vpcId) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("vpcId", vpcId); - return findOneBy(sc); - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/Site2SiteVpnGatewayVO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/Site2SiteVpnGatewayVO.java b/server/src/com/cloud/network/dao/Site2SiteVpnGatewayVO.java deleted file mode 100644 index 1e12971..0000000 --- a/server/src/com/cloud/network/dao/Site2SiteVpnGatewayVO.java +++ /dev/null @@ -1,114 +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.Date; -import java.util.UUID; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -import com.cloud.network.Site2SiteVpnGateway; -import com.cloud.utils.db.GenericDao; -import org.apache.cloudstack.api.InternalIdentity; - -@Entity -@Table(name=("s2s_vpn_gateway")) -public class Site2SiteVpnGatewayVO implements Site2SiteVpnGateway { - @Id - @GeneratedValue(strategy=GenerationType.IDENTITY) - @Column(name="id") - private long id; - - @Column(name="uuid") - private String uuid; - - @Column(name="addr_id") - private long addrId; - - @Column(name="vpc_id") - private long vpcId; - - @Column(name="domain_id") - private Long domainId; - - @Column(name="account_id") - private Long accountId; - - @Column(name=GenericDao.REMOVED_COLUMN) - private Date removed; - - public Site2SiteVpnGatewayVO() { } - - public Site2SiteVpnGatewayVO(long accountId, long domainId, long addrId, long vpcId) { - this.uuid = UUID.randomUUID().toString(); - this.setAddrId(addrId); - this.setVpcId(vpcId); - this.accountId = accountId; - this.domainId = domainId; - } - - @Override - public long getId() { - return id; - } - - @Override - public long getVpcId() { - return vpcId; - } - - public void setVpcId(long vpcId) { - this.vpcId = vpcId; - } - - @Override - public long getAddrId() { - return addrId; - } - - public void setAddrId(long addrId) { - this.addrId = addrId; - } - - @Override - public Date getRemoved() { - return removed; - } - - public void setRemoved(Date removed) { - this.removed = removed; - } - - public String getUuid() { - return uuid; - } - - @Override - public long getDomainId() { - return domainId; - } - - @Override - public long getAccountId() { - return accountId; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/UserIpv6AddressDao.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/UserIpv6AddressDao.java b/server/src/com/cloud/network/dao/UserIpv6AddressDao.java deleted file mode 100644 index 555b7f6..0000000 --- a/server/src/com/cloud/network/dao/UserIpv6AddressDao.java +++ /dev/null @@ -1,41 +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.Network; -import com.cloud.network.UserIpv6AddressVO; -import com.cloud.utils.db.GenericDao; - -public interface UserIpv6AddressDao extends GenericDao { - List listByAccount(long accountId); - - List listByVlanId(long vlanId); - - List listByDcId(long dcId); - - List listByNetwork(long networkId); - - public UserIpv6AddressVO findByNetworkIdAndIp(long networkId, String ipAddress); - - List listByPhysicalNetworkId(long physicalNetworkId); - - long countExistedIpsInNetwork(long networkId); - - long countExistedIpsInVlan(long vlanId); -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/UserIpv6AddressDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/UserIpv6AddressDaoImpl.java b/server/src/com/cloud/network/dao/UserIpv6AddressDaoImpl.java deleted file mode 100644 index c9f38ec..0000000 --- a/server/src/com/cloud/network/dao/UserIpv6AddressDaoImpl.java +++ /dev/null @@ -1,122 +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 java.util.Map; - -import javax.ejb.Local; -import javax.naming.ConfigurationException; - -import org.apache.log4j.Logger; -import org.springframework.stereotype.Component; - -import com.cloud.network.Network; -import com.cloud.network.UserIpv6AddressVO; -import com.cloud.utils.Pair; -import com.cloud.utils.db.Filter; -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.db.SearchCriteria2; - -@Component -@Local(value=UserIpv6AddressDao.class) -public class UserIpv6AddressDaoImpl extends GenericDaoBase implements UserIpv6AddressDao { - private static final Logger s_logger = Logger.getLogger(IPAddressDaoImpl.class); - - protected final SearchBuilder AllFieldsSearch; - protected GenericSearchBuilder CountFreePublicIps; - - public UserIpv6AddressDaoImpl() { - AllFieldsSearch = createSearchBuilder(); - AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), Op.EQ); - AllFieldsSearch.and("dataCenterId", AllFieldsSearch.entity().getDataCenterId(), Op.EQ); - AllFieldsSearch.and("ipAddress", AllFieldsSearch.entity().getAddress(), Op.EQ); - AllFieldsSearch.and("vlan", AllFieldsSearch.entity().getVlanId(), Op.EQ); - AllFieldsSearch.and("accountId", AllFieldsSearch.entity().getAccountId(), Op.EQ); - AllFieldsSearch.and("network", AllFieldsSearch.entity().getNetworkId(), Op.EQ); - AllFieldsSearch.and("physicalNetworkId", AllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ); - AllFieldsSearch.done(); - - CountFreePublicIps = createSearchBuilder(Long.class); - CountFreePublicIps.select(null, Func.COUNT, null); - CountFreePublicIps.and("networkId", CountFreePublicIps.entity().getSourceNetworkId(), SearchCriteria.Op.EQ); - CountFreePublicIps.and("vlanId", CountFreePublicIps.entity().getVlanId(), SearchCriteria.Op.EQ); - CountFreePublicIps.done(); - } - - @Override - public List listByAccount(long accountId) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("accountId", accountId); - return listBy(sc); - } - - @Override - public List listByVlanId(long vlanId) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("vlan", vlanId); - return listBy(sc); - } - - @Override - public List listByDcId(long dcId) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("dataCenterId", dcId); - return listBy(sc); - } - - @Override - public List listByNetwork(long networkId) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("network", networkId); - return listBy(sc); - } - - @Override - public UserIpv6AddressVO findByNetworkIdAndIp(long networkId, String ipAddress) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("networkId", networkId); - sc.setParameters("ipAddress", ipAddress); - return findOneBy(sc); - } - - @Override - public List listByPhysicalNetworkId(long physicalNetworkId) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("physicalNetworkId", physicalNetworkId); - return listBy(sc); - } - - @Override - public long countExistedIpsInNetwork(long networkId) { - SearchCriteria sc = CountFreePublicIps.create(); - sc.setParameters("networkId", networkId); - return customSearch(sc, null).get(0); - } - - @Override - public long countExistedIpsInVlan(long vlanId) { - SearchCriteria sc = CountFreePublicIps.create(); - sc.setParameters("vlanId", vlanId); - return customSearch(sc, null).get(0); - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/VirtualRouterProviderDao.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/VirtualRouterProviderDao.java b/server/src/com/cloud/network/dao/VirtualRouterProviderDao.java deleted file mode 100644 index d929293..0000000 --- a/server/src/com/cloud/network/dao/VirtualRouterProviderDao.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.network.dao; - -import java.util.List; - -import com.cloud.network.VirtualRouterProvider; -import com.cloud.network.element.VirtualRouterProviderVO; -import com.cloud.network.VirtualRouterProvider.VirtualRouterProviderType; -import com.cloud.utils.db.GenericDao; - -public interface VirtualRouterProviderDao extends GenericDao { - public VirtualRouterProviderVO findByNspIdAndType(long nspId, VirtualRouterProviderType type); - public List listByEnabledAndType(boolean enabled, VirtualRouterProviderType type); - public VirtualRouterProviderVO findByIdAndEnabledAndType(long id, boolean enabled, VirtualRouterProviderType type); - public List listByType(VirtualRouterProviderType type); -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/VirtualRouterProviderDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/VirtualRouterProviderDaoImpl.java b/server/src/com/cloud/network/dao/VirtualRouterProviderDaoImpl.java deleted file mode 100644 index dba835f..0000000 --- a/server/src/com/cloud/network/dao/VirtualRouterProviderDaoImpl.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.network.dao; - -import java.util.List; - -import javax.ejb.Local; - -import org.springframework.stereotype.Component; - -import com.cloud.network.element.VirtualRouterProviderVO; -import com.cloud.network.VirtualRouterProvider.VirtualRouterProviderType; -import com.cloud.utils.db.DB; -import com.cloud.utils.db.GenericDaoBase; -import com.cloud.utils.db.SearchBuilder; -import com.cloud.utils.db.SearchCriteria; - -@Component -@Local(value=VirtualRouterProviderDao.class) @DB(txn=false) -public class VirtualRouterProviderDaoImpl extends GenericDaoBase implements VirtualRouterProviderDao { - final SearchBuilder AllFieldsSearch; - - public VirtualRouterProviderDaoImpl() { - super(); - AllFieldsSearch = createSearchBuilder(); - AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), SearchCriteria.Op.EQ); - AllFieldsSearch.and("nsp_id", AllFieldsSearch.entity().getNspId(), SearchCriteria.Op.EQ); - AllFieldsSearch.and("uuid", AllFieldsSearch.entity().getUuid(), SearchCriteria.Op.EQ); - AllFieldsSearch.and("type", AllFieldsSearch.entity().getType(), SearchCriteria.Op.EQ); - AllFieldsSearch.and("enabled", AllFieldsSearch.entity().isEnabled(), SearchCriteria.Op.EQ); - AllFieldsSearch.done(); - } - - @Override - public VirtualRouterProviderVO findByNspIdAndType(long nspId, VirtualRouterProviderType type) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("nsp_id", nspId); - sc.setParameters("type", type); - return findOneBy(sc); - } - - @Override - public List listByEnabledAndType(boolean enabled, VirtualRouterProviderType type) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("enabled", enabled); - sc.setParameters("type", type); - return listBy(sc); - } - - @Override - public VirtualRouterProviderVO findByIdAndEnabledAndType(long id, boolean enabled, VirtualRouterProviderType type) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("id", id); - sc.setParameters("enabled", enabled); - sc.setParameters("type", type); - return findOneBy(sc); - } - - @Override - public List listByType(VirtualRouterProviderType type) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("type", type); - return listBy(sc); - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/VpnUserDao.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/VpnUserDao.java b/server/src/com/cloud/network/dao/VpnUserDao.java deleted file mode 100644 index 8ba742a..0000000 --- a/server/src/com/cloud/network/dao/VpnUserDao.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.dao; - -import java.util.List; - -import com.cloud.network.VpnUserVO; -import com.cloud.utils.db.GenericDao; - -public interface VpnUserDao extends GenericDao { - List listByAccount(Long accountId); - VpnUserVO findByAccountAndUsername(Long acccountId, String userName); - long getVpnUserCount(Long accountId); -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/dao/VpnUserDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/dao/VpnUserDaoImpl.java b/server/src/com/cloud/network/dao/VpnUserDaoImpl.java deleted file mode 100644 index cd3de79..0000000 --- a/server/src/com/cloud/network/dao/VpnUserDaoImpl.java +++ /dev/null @@ -1,87 +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.VpnUser.State; -import com.cloud.network.VpnUserVO; -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; - -@Component -@Local(value={VpnUserDao.class}) -public class VpnUserDaoImpl extends GenericDaoBase implements VpnUserDao { - private final SearchBuilder AccountSearch; - private final SearchBuilder AccountNameSearch; - private final GenericSearchBuilder VpnUserCount; - - - protected VpnUserDaoImpl() { - - AccountSearch = createSearchBuilder(); - AccountSearch.and("accountId", AccountSearch.entity().getAccountId(), SearchCriteria.Op.EQ); - AccountSearch.done(); - - AccountNameSearch = createSearchBuilder(); - AccountNameSearch.and("accountId", AccountNameSearch.entity().getAccountId(), SearchCriteria.Op.EQ); - AccountNameSearch.and("username", AccountNameSearch.entity().getUsername(), SearchCriteria.Op.EQ); - AccountNameSearch.done(); - - VpnUserCount = createSearchBuilder(Long.class); - VpnUserCount.and("accountId", VpnUserCount.entity().getAccountId(), SearchCriteria.Op.EQ); - VpnUserCount.and("state", VpnUserCount.entity().getState(), SearchCriteria.Op.NEQ); - VpnUserCount.select(null, Func.COUNT, null); - VpnUserCount.done(); - } - - @Override - public List listByAccount(Long accountId) { - SearchCriteria sc = AccountSearch.create(); - sc.setParameters("accountId", accountId); - return listBy(sc); - } - - @Override - public VpnUserVO findByAccountAndUsername(Long accountId, String userName) { - SearchCriteria sc = AccountNameSearch.create(); - sc.setParameters("accountId", accountId); - sc.setParameters("username", userName); - - return findOneBy(sc); - } - - @Override - public long getVpnUserCount(Long accountId) { - SearchCriteria sc = VpnUserCount.create(); - sc.setParameters("accountId", accountId); - sc.setParameters("state", State.Revoke); - List rs = customSearch(sc, null); - if (rs.size() == 0) { - return 0; - } - - return rs.get(0); - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/element/VirtualRouterProviderVO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/element/VirtualRouterProviderVO.java b/server/src/com/cloud/network/element/VirtualRouterProviderVO.java deleted file mode 100644 index ff2b621..0000000 --- a/server/src/com/cloud/network/element/VirtualRouterProviderVO.java +++ /dev/null @@ -1,120 +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.element; - -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 com.cloud.network.VirtualRouterProvider; -import com.cloud.utils.db.GenericDao; -import org.apache.cloudstack.api.InternalIdentity; - -@Entity -@Table(name=("virtual_router_providers")) -public class VirtualRouterProviderVO implements VirtualRouterProvider { - @Id - @GeneratedValue(strategy=GenerationType.IDENTITY) - @Column(name="id") - long id; - - @Column(name="type") - @Enumerated(EnumType.STRING) - private VirtualRouterProviderType type; - - @Column(name="enabled") - private boolean enabled; - - @Column(name="nsp_id") - private long nspId; - - @Column(name="uuid") - private String uuid; - - @Column(name=GenericDao.REMOVED_COLUMN) - Date removed; - - public VirtualRouterProviderVO() { - this.uuid = UUID.randomUUID().toString(); - } - - public VirtualRouterProviderVO(long nspId, VirtualRouterProviderType type) { - this.nspId = nspId; - this.type = type; - this.uuid = UUID.randomUUID().toString(); - } - - @Override - public long getNspId() { - return nspId; - } - - public String getUuid() { - return uuid; - } - - @Override - public long getId() { - return id; - } - - @Override - public VirtualRouterProviderType getType() { - return this.type; - } - - public Date getRemoved() { - return removed; - } - - public void setRemoved(Date removed) { - this.removed = removed; - } - - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - - @Override - public boolean isEnabled() { - return this.enabled; - } - - public void setId(long id) { - this.id = id; - } - - public void setType(VirtualRouterProviderType type) { - this.type = type; - } - - public void setNspId(long nspId) { - this.nspId = nspId; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/rules/FirewallRuleVO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/rules/FirewallRuleVO.java b/server/src/com/cloud/network/rules/FirewallRuleVO.java deleted file mode 100644 index a761520..0000000 --- a/server/src/com/cloud/network/rules/FirewallRuleVO.java +++ /dev/null @@ -1,270 +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.rules; - -import java.util.Date; -import java.util.List; -import java.util.UUID; - -import javax.inject.Inject; -import javax.persistence.Column; -import javax.persistence.DiscriminatorColumn; -import javax.persistence.DiscriminatorType; -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.Inheritance; -import javax.persistence.InheritanceType; -import javax.persistence.Table; -import javax.persistence.Transient; - -import com.cloud.network.dao.FirewallRulesCidrsDao; -import com.cloud.utils.db.GenericDao; -import com.cloud.utils.net.NetUtils; - -@Entity -@Table(name="firewall_rules") -@Inheritance(strategy=InheritanceType.JOINED) -@DiscriminatorColumn(name="purpose", discriminatorType=DiscriminatorType.STRING, length=32) -public class FirewallRuleVO implements FirewallRule { - - @Id - @GeneratedValue(strategy=GenerationType.IDENTITY) - @Column(name="id") - long id; - - @GeneratedValue(strategy=GenerationType.AUTO) - @Column(name=GenericDao.XID_COLUMN) - String xId; - - @Column(name="domain_id", updatable=false) - long domainId; - - @Column(name="account_id", updatable=false) - long accountId; - - @Column(name="ip_address_id", updatable=false) - Long sourceIpAddressId; - - @Column(name="start_port", updatable=false) - Integer sourcePortStart; - - @Column(name="end_port", updatable=false) - Integer sourcePortEnd; - - @Column(name="protocol", updatable=false) - String protocol = NetUtils.TCP_PROTO; - - @Enumerated(value=EnumType.STRING) - @Column(name="purpose") - Purpose purpose; - - @Enumerated(value=EnumType.STRING) - @Column(name="state") - State state; - - @Column(name=GenericDao.CREATED_COLUMN) - Date created; - - @Column(name="network_id") - Long networkId; - - @Column(name="icmp_code") - Integer icmpCode; - - @Column(name="icmp_type") - Integer icmpType; - - - @Column(name="related") - Long related; - - @Column(name="type") - @Enumerated(value=EnumType.STRING) - FirewallRuleType type; - - @Column(name="traffic_type") - @Enumerated(value=EnumType.STRING) - TrafficType trafficType; - - - // This is a delayed load value. If the value is null, - // then this field has not been loaded yet. - // Call firewallrules dao to load it. - @Transient - List sourceCidrs; - - @Column(name="uuid") - String uuid; - - public void setSourceCidrList(List sourceCidrs) { - this.sourceCidrs=sourceCidrs; - } - - @Override - public List getSourceCidrList() { - return sourceCidrs; - } - - @Override - public long getAccountId() { - return accountId; - } - - @Override - public long getDomainId() { - return domainId; - } - - @Override - public long getId() { - return id; - } - - @Override - public String getXid() { - return xId; - } - - @Override - public Long getSourceIpAddressId() { - return sourceIpAddressId; - } - - @Override - public Integer getSourcePortStart() { - return sourcePortStart; - } - - @Override - public Integer getSourcePortEnd() { - return sourcePortEnd; - } - - @Override - public String getProtocol() { - return protocol; - } - - public void setState(State state) { - this.state = state; - } - - @Override - public Purpose getPurpose() { - return purpose; - } - - @Override - public State getState() { - return state; - } - - @Override - public long getNetworkId() { - return networkId; - } - - @Override - public FirewallRuleType getType() { - return type; - } - public Date getCreated() { - return created; - } - - protected FirewallRuleVO() { - this.uuid = UUID.randomUUID().toString(); - } - - public FirewallRuleVO(String xId, Long ipAddressId, Integer portStart, Integer portEnd, String protocol, - long networkId, long accountId, long domainId, Purpose purpose, List sourceCidrs, Integer icmpCode, - Integer icmpType, Long related, TrafficType trafficType) { - this.xId = xId; - if (xId == null) { - this.xId = UUID.randomUUID().toString(); - } - this.accountId = accountId; - this.domainId = domainId; - this.sourceIpAddressId = ipAddressId; - this.sourcePortStart = portStart; - this.sourcePortEnd = portEnd; - this.protocol = protocol; - this.purpose = purpose; - this.networkId = networkId; - this.state = State.Staged; - this.icmpCode = icmpCode; - this.icmpType = icmpType; - this.sourceCidrs = sourceCidrs; - - if (related != null) { - assert (purpose == Purpose.Firewall) : "related field can be set for rule of purpose " + Purpose.Firewall + " only"; - } - - this.related = related; - this.uuid = UUID.randomUUID().toString(); - this.type = FirewallRuleType.User; - this.trafficType = trafficType; - } - - - public FirewallRuleVO(String xId, long ipAddressId, int port, String protocol, long networkId, long accountId, - long domainId, Purpose purpose, List sourceCidrs, Integer icmpCode, Integer icmpType, Long related) { - this(xId, ipAddressId, port, port, protocol, networkId, accountId, domainId, purpose, sourceCidrs, icmpCode, icmpType, related, null); - } - - @Override - public String toString() { - return new StringBuilder("Rule[").append(id).append("-").append(purpose).append("-").append(state).append("]").toString(); - } - - @Override - public Integer getIcmpCode() { - return icmpCode; - } - - @Override - public Integer getIcmpType() { - return icmpType; - } - - @Override - public Long getRelated() { - return related; - } - - @Override - public String getUuid() { - return this.uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public void setType(FirewallRuleType type) { - this.type = type; - } - - @Override - public TrafficType getTrafficType() { - return trafficType; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/rules/PortForwardingRuleVO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/rules/PortForwardingRuleVO.java b/server/src/com/cloud/network/rules/PortForwardingRuleVO.java deleted file mode 100644 index 0bd78ff..0000000 --- a/server/src/com/cloud/network/rules/PortForwardingRuleVO.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.rules; - -import java.util.List; - -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.utils.net.Ip; - -@Entity -@Table(name=("port_forwarding_rules")) -@DiscriminatorValue(value="PortForwarding") -@PrimaryKeyJoinColumn(name="id") -public class PortForwardingRuleVO extends FirewallRuleVO implements PortForwardingRule { - - @Enumerated(value=EnumType.STRING) - @Column(name="dest_ip_address") - private Ip destinationIpAddress = null; - - @Column(name="dest_port_start") - private int destinationPortStart; - - @Column(name="dest_port_end") - private int destinationPortEnd; - - @Column(name="instance_id") - private long virtualMachineId; - - public PortForwardingRuleVO() { - } - - public PortForwardingRuleVO(String xId, long srcIpId, int srcPortStart, int srcPortEnd, Ip dstIp, int dstPortStart, int dstPortEnd, String protocol, long networkId, long accountId, long domainId, long instanceId) { - super(xId, srcIpId, srcPortStart, srcPortEnd, protocol, networkId, accountId, domainId, Purpose.PortForwarding, null, null, null, null, null); - this.destinationIpAddress = dstIp; - this.virtualMachineId = instanceId; - this.destinationPortStart = dstPortStart; - this.destinationPortEnd = dstPortEnd; - } - - public PortForwardingRuleVO(String xId, long srcIpId, int srcPort, Ip dstIp, int dstPort, String protocol, List sourceCidrs, long networkId, long accountId, long domainId, long instanceId) { - this(xId, srcIpId, srcPort, srcPort, dstIp, dstPort, dstPort, protocol.toLowerCase(), networkId, accountId, domainId, instanceId); - } - - @Override - public Ip getDestinationIpAddress() { - return destinationIpAddress; - } - - @Override - public void setDestinationIpAddress(Ip destinationIpAddress) { - this.destinationIpAddress = destinationIpAddress; - } - - @Override - public int getDestinationPortStart() { - return destinationPortStart; - } - - @Override - public int getDestinationPortEnd() { - return destinationPortEnd; - } - - @Override - public long getVirtualMachineId() { - return virtualMachineId; - } - - @Override - public Long getRelated() { - return null; - } - -} - http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/rules/dao/PortForwardingRulesDao.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/rules/dao/PortForwardingRulesDao.java b/server/src/com/cloud/network/rules/dao/PortForwardingRulesDao.java deleted file mode 100644 index 682a941..0000000 --- a/server/src/com/cloud/network/rules/dao/PortForwardingRulesDao.java +++ /dev/null @@ -1,47 +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.rules.dao; - -import java.util.List; - -import com.cloud.network.rules.PortForwardingRuleVO; -import com.cloud.utils.db.GenericDao; - -public interface PortForwardingRulesDao extends GenericDao { - List listForApplication(long ipId); - - /** - * Find all port forwarding rules for the ip address that have not been revoked. - * - * @param ip ip address - * @return List of PortForwardingRuleVO - */ - List listByIpAndNotRevoked(long ipId); - - List listByNetworkAndNotRevoked(long networkId); - - List listByIp(long ipId); - - List listByVm(Long vmId); - - List listByNetwork(long networkId); - - List listByAccount(long accountId); - - List listByDestIpAddr(String ip4Address); - -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/server/src/com/cloud/network/rules/dao/PortForwardingRulesDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/network/rules/dao/PortForwardingRulesDaoImpl.java b/server/src/com/cloud/network/rules/dao/PortForwardingRulesDaoImpl.java deleted file mode 100644 index cc780cb..0000000 --- a/server/src/com/cloud/network/rules/dao/PortForwardingRulesDaoImpl.java +++ /dev/null @@ -1,162 +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.rules.dao; - -import java.util.List; - -import javax.ejb.Local; -import javax.inject.Inject; - -import org.springframework.stereotype.Component; - -import com.cloud.network.dao.FirewallRulesCidrsDao; -import com.cloud.network.dao.FirewallRulesCidrsDaoImpl; -import com.cloud.network.rules.FirewallRule.Purpose; -import com.cloud.network.rules.FirewallRule.State; -import com.cloud.network.rules.PortForwardingRuleVO; - -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 com.cloud.vm.dao.NicSecondaryIpVO; - -@Component -@Local(value=PortForwardingRulesDao.class) -public class PortForwardingRulesDaoImpl extends GenericDaoBase implements PortForwardingRulesDao { - - protected final SearchBuilder AllFieldsSearch; - protected final SearchBuilder ApplicationSearch; - protected final SearchBuilder ActiveRulesSearch; - protected final SearchBuilder AllRulesSearchByVM; - protected final SearchBuilder ActiveRulesSearchByAccount; - - @Inject protected FirewallRulesCidrsDao _portForwardingRulesCidrsDao; - - protected PortForwardingRulesDaoImpl() { - super(); - AllFieldsSearch = createSearchBuilder(); - AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), Op.EQ); - AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), Op.EQ); - AllFieldsSearch.and("ipId", AllFieldsSearch.entity().getSourceIpAddressId(), Op.EQ); - AllFieldsSearch.and("protocol", AllFieldsSearch.entity().getProtocol(), Op.EQ); - AllFieldsSearch.and("networkId", AllFieldsSearch.entity().getNetworkId(), Op.EQ); - AllFieldsSearch.and("vmId", AllFieldsSearch.entity().getVirtualMachineId(), Op.EQ); - AllFieldsSearch.and("purpose", AllFieldsSearch.entity().getPurpose(), Op.EQ); - AllFieldsSearch.and("dstIp", AllFieldsSearch.entity().getDestinationIpAddress(), Op.EQ); - AllFieldsSearch.done(); - - ApplicationSearch = createSearchBuilder(); - ApplicationSearch.and("ipId", ApplicationSearch.entity().getSourceIpAddressId(), Op.EQ); - ApplicationSearch.and("state", ApplicationSearch.entity().getState(), Op.NEQ); - ApplicationSearch.and("purpose", ApplicationSearch.entity().getPurpose(), Op.EQ); - ApplicationSearch.done(); - - - ActiveRulesSearch = createSearchBuilder(); - ActiveRulesSearch.and("ipId", ActiveRulesSearch.entity().getSourceIpAddressId(), Op.EQ); - ActiveRulesSearch.and("networkId", ActiveRulesSearch.entity().getNetworkId(), Op.EQ); - ActiveRulesSearch.and("state", ActiveRulesSearch.entity().getState(), Op.NEQ); - ActiveRulesSearch.and("purpose", ActiveRulesSearch.entity().getPurpose(), Op.EQ); - ActiveRulesSearch.done(); - - AllRulesSearchByVM = createSearchBuilder(); - AllRulesSearchByVM.and("vmId", AllRulesSearchByVM.entity().getVirtualMachineId(), Op.EQ); - AllRulesSearchByVM.and("purpose", AllRulesSearchByVM.entity().getPurpose(), Op.EQ); - AllRulesSearchByVM.done(); - - ActiveRulesSearchByAccount = createSearchBuilder(); - ActiveRulesSearchByAccount.and("accountId", ActiveRulesSearchByAccount.entity().getAccountId(), Op.EQ); - ActiveRulesSearchByAccount.and("state", ActiveRulesSearchByAccount.entity().getState(), Op.NEQ); - ActiveRulesSearchByAccount.and("purpose", ActiveRulesSearchByAccount.entity().getPurpose(), Op.EQ); - ActiveRulesSearchByAccount.done(); - } - - @Override - public List listForApplication(long ipId) { - SearchCriteria sc = ApplicationSearch.create(); - sc.setParameters("ipId", ipId); - sc.setParameters("state", State.Staged); - sc.setParameters("purpose", Purpose.PortForwarding); - - return listBy(sc, null); - } - - @Override - public List listByVm(Long vmId) { - SearchCriteria sc = AllRulesSearchByVM.create(); - sc.setParameters("vmId", vmId); - sc.setParameters("purpose", Purpose.PortForwarding); - - return listBy(sc, null); - } - - @Override - public List listByIpAndNotRevoked(long ipId) { - SearchCriteria sc = ActiveRulesSearch.create(); - sc.setParameters("ipId", ipId); - sc.setParameters("state", State.Revoke); - sc.setParameters("purpose", Purpose.PortForwarding); - - return listBy(sc, null); - } - - @Override - public List listByNetworkAndNotRevoked(long networkId) { - SearchCriteria sc = ActiveRulesSearch.create(); - sc.setParameters("networkId", networkId); - sc.setParameters("state", State.Revoke); - sc.setParameters("purpose", Purpose.PortForwarding); - - return listBy(sc, null); - } - - @Override - public List listByIp(long ipId) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("ipId", ipId); - sc.setParameters("purpose", Purpose.PortForwarding); - - return listBy(sc, null); - } - - @Override - public List listByNetwork(long networkId) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("networkId", networkId); - sc.setParameters("purpose", Purpose.PortForwarding); - - return listBy(sc); - } - - @Override - public List listByAccount(long accountId) { - SearchCriteria sc = ActiveRulesSearchByAccount.create(); - sc.setParameters("accountId", accountId); - sc.setParameters("state", State.Revoke); - sc.setParameters("purpose", Purpose.PortForwarding); - - return listBy(sc); - } - @Override - public List listByDestIpAddr(String ip4Address) { - SearchCriteria sc = AllFieldsSearch.create(); - sc.setParameters("dstIp", ip4Address); - return listBy(sc); - } - -}