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:01:25 UTC
[09/72] [abbrv] [partial] Moved most of the VOs and DAOs from server
package into engine-schema as well
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/network/dao/NetworkVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/dao/NetworkVO.java b/server/src/com/cloud/network/dao/NetworkVO.java
deleted file mode 100644
index 8e728ab..0000000
--- a/server/src/com/cloud/network/dao/NetworkVO.java
+++ /dev/null
@@ -1,540 +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.net.URI;
-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.Id;
-import javax.persistence.Table;
-import javax.persistence.TableGenerator;
-import javax.persistence.Transient;
-
-import org.apache.cloudstack.acl.ControlledEntity;
-
-import com.cloud.network.Network;
-import com.cloud.network.Networks.BroadcastDomainType;
-import com.cloud.network.Networks.Mode;
-import com.cloud.network.Networks.TrafficType;
-import com.cloud.utils.NumbersUtil;
-import com.cloud.utils.db.GenericDao;
-import com.cloud.utils.net.NetUtils;
-
-/**
- * NetworkConfigurationVO contains information about a specific network.
- *
- */
-@Entity
-@Table(name="networks")
-public class NetworkVO implements Network {
- @Id
- @TableGenerator(name="networks_sq", table="sequence", pkColumnName="name", valueColumnName="value", pkColumnValue="networks_seq", allocationSize=1)
- @Column(name="id")
- long id;
-
- @Column(name="mode")
- @Enumerated(value=EnumType.STRING)
- Mode mode;
-
- @Column(name="broadcast_domain_type")
- @Enumerated(value=EnumType.STRING)
- BroadcastDomainType broadcastDomainType;
-
- @Column(name="traffic_type")
- @Enumerated(value=EnumType.STRING)
- TrafficType trafficType;
-
- @Column(name="name")
- String name;
-
- @Column(name="display_text")
- String displayText;;
-
- @Column(name="broadcast_uri")
- URI broadcastUri;
-
- @Column(name="gateway")
- String gateway;
-
- @Column(name="cidr")
- String cidr;
-
- @Column(name="network_cidr")
- String networkCidr;
-
- @Column(name="network_offering_id")
- long networkOfferingId;
-
- @Column(name="vpc_id")
- Long vpcId;
-
- @Column(name="physical_network_id")
- Long physicalNetworkId;
-
- @Column(name="data_center_id")
- long dataCenterId;
-
- @Column(name="related")
- long related;
-
- @Column(name="guru_name")
- String guruName;
-
- @Column(name="state")
- @Enumerated(value=EnumType.STRING)
- State state;
-
- @Column(name="dns1")
- String dns1;
-
- @Column(name="domain_id")
- long domainId;
-
- @Column(name="account_id")
- long accountId;
-
- @Column(name="set_fields")
- long setFields;
-
- @TableGenerator(name="mac_address_seq", table="op_networks", pkColumnName="id", valueColumnName="mac_address_seq", allocationSize=1)
- @Transient
- long macAddress = 1;
-
- @Column(name="guru_data", length=1024)
- String guruData;
-
- @Column(name="dns2")
- String dns2;
-
- @Column(name="network_domain")
- String networkDomain;
-
- @Column(name=GenericDao.REMOVED_COLUMN)
- Date removed;
-
- @Column(name=GenericDao.CREATED_COLUMN)
- Date created;
-
- @Column(name="reservation_id")
- String reservationId;
-
- @Column(name="uuid")
- String uuid;
-
- @Column(name="guest_type")
- @Enumerated(value=EnumType.STRING)
- Network.GuestType guestType;
-
- @Column(name="acl_type")
- @Enumerated(value=EnumType.STRING)
- ControlledEntity.ACLType aclType;
-
- @Column(name="restart_required")
- boolean restartRequired = false;
-
- @Column(name="specify_ip_ranges")
- boolean specifyIpRanges = false;
-
- @Column(name="ip6_gateway")
- String ip6Gateway;
-
- @Column(name="ip6_cidr")
- String ip6Cidr;
-
- public NetworkVO() {
- this.uuid = UUID.randomUUID().toString();
- }
-
- /**
- * Constructor to be used for the adapters because it only initializes what's needed.
- * @param trafficType
- * @param mode
- * @param broadcastDomainType
- * @param networkOfferingId
- * @param state TODO
- * @param dataCenterId
- * @param physicalNetworkId TODO
- */
- public NetworkVO(TrafficType trafficType, Mode mode, BroadcastDomainType broadcastDomainType, long networkOfferingId,
- State state, long dataCenterId, Long physicalNetworkId) {
- this.trafficType = trafficType;
- this.mode = mode;
- this.broadcastDomainType = broadcastDomainType;
- this.networkOfferingId = networkOfferingId;
- this.dataCenterId = dataCenterId;
- this.physicalNetworkId = physicalNetworkId;
- if (state == null) {
- state = State.Allocated;
- } else {
- this.state = state;
- }
- this.id = -1;
- this.uuid = UUID.randomUUID().toString();
- }
-
- public NetworkVO(long id, Network that, long offeringId, String guruName, long domainId, long accountId,
- long related, String name, String displayText, String networkDomain, GuestType guestType, long dcId,
- Long physicalNetworkId, ACLType aclType, boolean specifyIpRanges, Long vpcId) {
- this(id, that.getTrafficType(), that.getMode(), that.getBroadcastDomainType(), offeringId, domainId, accountId,
- related, name, displayText, networkDomain, guestType, dcId, physicalNetworkId, aclType, specifyIpRanges, vpcId);
- this.gateway = that.getGateway();
- this.cidr = that.getCidr();
- this.networkCidr = that.getNetworkCidr();
- this.broadcastUri = that.getBroadcastUri();
- this.broadcastDomainType = that.getBroadcastDomainType();
- this.guruName = guruName;
- this.state = that.getState();
- if (state == null) {
- state = State.Allocated;
- }
- this.uuid = UUID.randomUUID().toString();
- this.ip6Gateway = that.getIp6Gateway();
- this.ip6Cidr = that.getIp6Cidr();
- }
-
- /**
- * Constructor for the actual DAO object.
- * @param trafficType
- * @param mode
- * @param broadcastDomainType
- * @param networkOfferingId
- * @param domainId
- * @param accountId
- * @param name
- * @param displayText
- * @param networkDomain
- * @param guestType TODO
- * @param aclType TODO
- * @param specifyIpRanges TODO
- * @param vpcId TODO
- * @param dataCenterId
- */
- public NetworkVO(long id, TrafficType trafficType, Mode mode, BroadcastDomainType broadcastDomainType,
- long networkOfferingId, long domainId, long accountId, long related, String name, String displayText,
- String networkDomain, GuestType guestType, long dcId, Long physicalNetworkId, ACLType aclType, boolean specifyIpRanges, Long vpcId) {
- this(trafficType, mode, broadcastDomainType, networkOfferingId, State.Allocated, dcId, physicalNetworkId);
- this.domainId = domainId;
- this.accountId = accountId;
- this.related = related;
- this.id = id;
- this.name = name;
- this.displayText = displayText;
- this.aclType = aclType;
- this.networkDomain = networkDomain;
- this.uuid = UUID.randomUUID().toString();
- this.guestType = guestType;
- this.specifyIpRanges = specifyIpRanges;
- this.vpcId = vpcId;
- }
-
- @Override
- public String getReservationId() {
- return reservationId;
- }
-
- public void setReservationId(String reservationId) {
- this.reservationId = reservationId;
- }
-
- @Override
- public State getState() {
- return state;
- }
-
- // don't use this directly when possible, use Network state machine instead
- public void setState(State state) {
- this.state = state;
- }
-
- @Override
- public long getRelated() {
- return related;
- }
-
- @Override
- public long getId() {
- return id;
- }
-
- @Override
- public Mode getMode() {
- return mode;
- }
-
- @Override
- public long getAccountId() {
- return accountId;
- }
-
- @Override
- public long getDomainId() {
- return domainId;
- }
-
- @Override
- public long getNetworkOfferingId() {
- return networkOfferingId;
- }
-
- public void setNetworkOfferingId(long networkOfferingId) {
- this.networkOfferingId = networkOfferingId;
- }
-
- public void setMode(Mode mode) {
- this.mode = mode;
- }
-
- @Override
- public BroadcastDomainType getBroadcastDomainType() {
- return broadcastDomainType;
- }
-
- public String getGuruData() {
- return guruData;
- }
-
- public void setGuruData(String guruData) {
- this.guruData = guruData;
- }
-
- public String getGuruName() {
- return guruName;
- }
-
- public void setGuruName(String guruName) {
- this.guruName = guruName;
- }
-
- public void setBroadcastDomainType(BroadcastDomainType broadcastDomainType) {
- this.broadcastDomainType = broadcastDomainType;
- }
-
- @Override
- public String getNetworkDomain() {
- return networkDomain;
- }
-
- public void setNetworkDomain(String networkDomain) {
- this.networkDomain = networkDomain;
- }
-
- @Override
- public TrafficType getTrafficType() {
- return trafficType;
- }
-
- public void setTrafficType(TrafficType trafficType) {
- this.trafficType = trafficType;
- }
-
- @Override
- public String getGateway() {
- return gateway;
- }
-
- public void setGateway(String gateway) {
- this.gateway = gateway;
- }
- // "cidr" is the Cloudstack managed address space, all CloudStack managed vms get IP address from "cidr"
- // In general "cidr" also serves as the network cidr
- // But in case IP reservation feature is configured for a Guest network, "network_cidr" is the Effective network cidr for the network,
- // "cidr" will still continue to be the effective address space for CloudStack managed vms in that Guest network
- @Override
- public String getCidr() {
- return cidr;
- }
-
- public void setCidr(String cidr) {
- this.cidr = cidr;
- }
-
- // "networkcidr" is the network CIDR of the guest network which is configured with IP reservation feature
- // It is the summation of "cidr" and the reservedIPrange(the address space used for non cloudstack purposes.)
- // For networks not using IP reservation "networkcidr" is always null
- @Override
- public String getNetworkCidr() {
- return networkCidr;
- }
-
- public void setNetworkCidr(String networkCidr) {
- this.networkCidr = networkCidr;
- }
-
- @Override
- public URI getBroadcastUri() {
- return broadcastUri;
- }
-
- public void setBroadcastUri(URI broadcastUri) {
- this.broadcastUri = broadcastUri;
- }
-
- @Override
- public int hashCode() {
- return NumbersUtil.hash(id);
- }
-
- @Override
- public Long getPhysicalNetworkId() {
- return physicalNetworkId;
- }
-
- @Override
- public void setPhysicalNetworkId(Long physicalNetworkId) {
- this.physicalNetworkId = physicalNetworkId;
- }
-
- @Override
- public long getDataCenterId() {
- return dataCenterId;
- }
-
- public String getDns1() {
- return dns1;
- }
-
- public void setDns1(String dns) {
- this.dns1 = dns;
- }
-
- public String getDns2() {
- return dns2;
- }
-
- public void setDns2(String dns) {
- this.dns2 = dns;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- @Override
- public String getDisplayText() {
- return displayText;
- }
-
- public void setDisplayText(String displayText) {
- this.displayText = displayText;
- }
-
- public Date getRemoved() {
- return removed;
- }
-
- public void setRemoved(Date removed) {
- this.removed = removed;
- }
-
- public Date getCreated() {
- return created;
- }
-
- public void setCreated(Date created) {
- this.created = created;
- }
-
- @Override
- public Network.GuestType getGuestType() {
- return guestType;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof NetworkVO)) {
- return false;
- }
- NetworkVO that = (NetworkVO)obj;
- if (this.trafficType != that.trafficType) {
- return false;
- }
-
- if ((this.cidr == null && that.cidr != null) || (this.cidr != null && that.cidr == null)) {
- return false;
- }
-
- if (this.cidr == null && that.cidr == null) {
- return true;
- }
-
- return NetUtils.isNetworkAWithinNetworkB(this.cidr, that.cidr);
- }
-
- @Override
- public String toString() {
- StringBuilder buf = new StringBuilder("Ntwk[");
- buf.append(id).append("|").append(trafficType).append("|").append(networkOfferingId).append("]");
- return buf.toString();
- }
-
- public String getUuid() {
- return this.uuid;
- }
-
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- public ControlledEntity.ACLType getAclType() {
- return aclType;
- }
-
- public void setRestartRequired(boolean restartRequired) {
- this.restartRequired = restartRequired;
- }
-
- @Override
- public boolean isRestartRequired() {
- return restartRequired;
- }
-
- @Override
- public boolean getSpecifyIpRanges() {
- return specifyIpRanges;
- }
-
- @Override
- public Long getVpcId() {
- return vpcId;
- }
-
- public String getIp6Cidr() {
- return ip6Cidr;
- }
-
- public void setIp6Cidr(String ip6Cidr) {
- this.ip6Cidr = ip6Cidr;
- }
-
- public String getIp6Gateway() {
- return ip6Gateway;
- }
-
- public void setIp6Gateway(String ip6Gateway) {
- this.ip6Gateway = ip6Gateway;
- }
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/network/dao/PhysicalNetworkDao.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/dao/PhysicalNetworkDao.java b/server/src/com/cloud/network/dao/PhysicalNetworkDao.java
deleted file mode 100644
index 891fbfd..0000000
--- a/server/src/com/cloud/network/dao/PhysicalNetworkDao.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.Networks.TrafficType;
-import com.cloud.utils.db.GenericDao;
-
-public interface PhysicalNetworkDao extends GenericDao<PhysicalNetworkVO, Long> {
- List<PhysicalNetworkVO> listByZone(long zoneId);
- List<PhysicalNetworkVO> listByZoneIncludingRemoved(long zoneId);
- List<PhysicalNetworkVO> listByZoneAndTrafficType(long dataCenterId, TrafficType trafficType);
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/network/dao/PhysicalNetworkDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/dao/PhysicalNetworkDaoImpl.java b/server/src/com/cloud/network/dao/PhysicalNetworkDaoImpl.java
deleted file mode 100644
index 1e26a51..0000000
--- a/server/src/com/cloud/network/dao/PhysicalNetworkDaoImpl.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 javax.inject.Inject;
-
-import org.springframework.stereotype.Component;
-
-import com.cloud.network.Networks.TrafficType;
-import com.cloud.utils.db.DB;
-import com.cloud.utils.db.GenericDaoBase;
-import com.cloud.utils.db.JoinBuilder;
-import com.cloud.utils.db.SearchBuilder;
-import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.db.SearchCriteria.Op;
-
-@Component
-@Local(value=PhysicalNetworkDao.class) @DB(txn=false)
-public class PhysicalNetworkDaoImpl extends GenericDaoBase<PhysicalNetworkVO, Long> implements PhysicalNetworkDao {
- final SearchBuilder<PhysicalNetworkVO> ZoneSearch;
-
- @Inject protected PhysicalNetworkTrafficTypeDao _trafficTypeDao;
-
- protected PhysicalNetworkDaoImpl() {
- super();
- ZoneSearch = createSearchBuilder();
- ZoneSearch.and("dataCenterId", ZoneSearch.entity().getDataCenterId(), Op.EQ);
- ZoneSearch.done();
- }
-
- @Override
- public List<PhysicalNetworkVO> listByZone(long zoneId) {
- SearchCriteria<PhysicalNetworkVO> sc = ZoneSearch.create();
- sc.setParameters("dataCenterId", zoneId);
- return search(sc, null);
- }
-
- @Override
- public List<PhysicalNetworkVO> listByZoneIncludingRemoved(long zoneId) {
- SearchCriteria<PhysicalNetworkVO> sc = ZoneSearch.create();
- sc.setParameters("dataCenterId", zoneId);
- return listIncludingRemovedBy(sc);
- }
-
- @Override
- public List<PhysicalNetworkVO> listByZoneAndTrafficType(long dataCenterId, TrafficType trafficType) {
-
- SearchBuilder<PhysicalNetworkTrafficTypeVO> trafficTypeSearch = _trafficTypeDao.createSearchBuilder();
- PhysicalNetworkTrafficTypeVO trafficTypeEntity = trafficTypeSearch.entity();
- trafficTypeSearch.and("trafficType", trafficTypeSearch.entity().getTrafficType(), SearchCriteria.Op.EQ);
-
- SearchBuilder<PhysicalNetworkVO> pnSearch = createSearchBuilder();
- pnSearch.and("dataCenterId", pnSearch.entity().getDataCenterId(), Op.EQ);
- pnSearch.join("trafficTypeSearch", trafficTypeSearch, pnSearch.entity().getId(), trafficTypeEntity.getPhysicalNetworkId(), JoinBuilder.JoinType.INNER);
-
- SearchCriteria<PhysicalNetworkVO> sc = pnSearch.create();
- sc.setJoinParameters("trafficTypeSearch", "trafficType", trafficType);
- sc.setParameters("dataCenterId", dataCenterId);
-
- return listBy(sc);
- }
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/network/dao/PhysicalNetworkIsolationMethodDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/dao/PhysicalNetworkIsolationMethodDaoImpl.java b/server/src/com/cloud/network/dao/PhysicalNetworkIsolationMethodDaoImpl.java
deleted file mode 100644
index 04508e7..0000000
--- a/server/src/com/cloud/network/dao/PhysicalNetworkIsolationMethodDaoImpl.java
+++ /dev/null
@@ -1,70 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.network.dao;
-
-import java.util.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 PhysicalNetworkIsolationMethodDaoImpl extends GenericDaoBase<PhysicalNetworkIsolationMethodVO, Long> implements GenericDao<PhysicalNetworkIsolationMethodVO, Long> {
- private final GenericSearchBuilder<PhysicalNetworkIsolationMethodVO, String> IsolationMethodSearch;
- private final SearchBuilder<PhysicalNetworkIsolationMethodVO> AllFieldsSearch;
-
- protected PhysicalNetworkIsolationMethodDaoImpl() {
- super();
- IsolationMethodSearch = createSearchBuilder(String.class);
- IsolationMethodSearch.selectField(IsolationMethodSearch.entity().getIsolationMethod());
- IsolationMethodSearch.and("physicalNetworkId", IsolationMethodSearch.entity().getPhysicalNetworkId(), Op.EQ);
- IsolationMethodSearch.done();
-
- AllFieldsSearch = createSearchBuilder();
- AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), Op.EQ);
- AllFieldsSearch.and("physicalNetworkId", AllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ);
- AllFieldsSearch.and("isolationMethod", AllFieldsSearch.entity().getIsolationMethod(), Op.EQ);
- AllFieldsSearch.done();
- }
-
- public List<String> getAllIsolationMethod(long physicalNetworkId) {
- SearchCriteria<String> sc = IsolationMethodSearch.create();
- sc.setParameters("physicalNetworkId", physicalNetworkId);
-
- return customSearch(sc, null);
- }
-
- public String getIsolationMethod(long physicalNetworkId) {
- SearchCriteria<String> sc = IsolationMethodSearch.create();
- sc.setParameters("physicalNetworkId", physicalNetworkId);
-
- return customSearch(sc, null).get(0);
- }
-
- public int clearIsolationMethods(long physicalNetworkId) {
- SearchCriteria<PhysicalNetworkIsolationMethodVO> sc = AllFieldsSearch.create();
- sc.setParameters("physicalNetworkId", physicalNetworkId);
-
- return remove(sc);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/network/dao/PhysicalNetworkIsolationMethodVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/dao/PhysicalNetworkIsolationMethodVO.java b/server/src/com/cloud/network/dao/PhysicalNetworkIsolationMethodVO.java
deleted file mode 100644
index 5996704..0000000
--- a/server/src/com/cloud/network/dao/PhysicalNetworkIsolationMethodVO.java
+++ /dev/null
@@ -1,68 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.network.dao;
-
-import org.apache.cloudstack.api.InternalIdentity;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-/**
- *
- */
-@Entity
-@Table(name = "physical_network_isolation_methods")
-public class PhysicalNetworkIsolationMethodVO implements InternalIdentity {
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id")
- private long id;
-
- @Column(name = "physical_network_id")
- private long physicalNetworkId;
-
- @Column(name = "isolation_method")
- private String isolationMethod;
-
- /**
- * There should never be a public constructor for this class. Since it's
- * only here to define the table for the DAO class.
- */
- protected PhysicalNetworkIsolationMethodVO() {
- }
-
- protected PhysicalNetworkIsolationMethodVO(long physicalNetworkId, String isolationMethod) {
- this.physicalNetworkId = physicalNetworkId;
- this.isolationMethod = isolationMethod;
- }
-
- public long getId() {
- return id;
- }
-
- public long getPhysicalNetworkId() {
- return physicalNetworkId;
- }
-
- public String getIsolationMethod() {
- return isolationMethod;
- }
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/network/dao/PhysicalNetworkServiceProviderDao.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/dao/PhysicalNetworkServiceProviderDao.java b/server/src/com/cloud/network/dao/PhysicalNetworkServiceProviderDao.java
deleted file mode 100644
index 9e0ba17..0000000
--- a/server/src/com/cloud/network/dao/PhysicalNetworkServiceProviderDao.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.utils.db.GenericDao;
-
-public interface PhysicalNetworkServiceProviderDao extends GenericDao<PhysicalNetworkServiceProviderVO, Long> {
- List<PhysicalNetworkServiceProviderVO> listBy(long physicalNetworkId);
- PhysicalNetworkServiceProviderVO findByServiceProvider(long physicalNetworkId, String providerType);
- void deleteProviders(long physicalNetworkId);
- boolean isServiceProviderEnabled(long physicalNetworkId, String providerType, String serviceType);
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/network/dao/PhysicalNetworkServiceProviderDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/dao/PhysicalNetworkServiceProviderDaoImpl.java b/server/src/com/cloud/network/dao/PhysicalNetworkServiceProviderDaoImpl.java
deleted file mode 100644
index 16a23dd..0000000
--- a/server/src/com/cloud/network/dao/PhysicalNetworkServiceProviderDaoImpl.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 com.cloud.network.dao;
-
-import java.util.List;
-
-import javax.ejb.Local;
-
-import org.springframework.stereotype.Component;
-
-import com.cloud.network.Network.Service;
-import com.cloud.network.PhysicalNetworkServiceProvider;
-import com.cloud.utils.db.DB;
-import com.cloud.utils.db.GenericDaoBase;
-import com.cloud.utils.db.SearchBuilder;
-import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.db.SearchCriteria.Op;
-
-@Component
-@Local(value=PhysicalNetworkServiceProviderDao.class) @DB(txn=false)
-public class PhysicalNetworkServiceProviderDaoImpl extends GenericDaoBase<PhysicalNetworkServiceProviderVO, Long> implements PhysicalNetworkServiceProviderDao {
- final SearchBuilder<PhysicalNetworkServiceProviderVO> physicalNetworkSearch;
- final SearchBuilder<PhysicalNetworkServiceProviderVO> physicalNetworkServiceProviderSearch;
- final SearchBuilder<PhysicalNetworkServiceProviderVO> AllFieldsSearch;
-
- protected PhysicalNetworkServiceProviderDaoImpl() {
- super();
- physicalNetworkSearch = createSearchBuilder();
- physicalNetworkSearch.and("physicalNetworkId", physicalNetworkSearch.entity().getPhysicalNetworkId(), Op.EQ);
- physicalNetworkSearch.done();
-
- physicalNetworkServiceProviderSearch = createSearchBuilder();
- physicalNetworkServiceProviderSearch.and("physicalNetworkId", physicalNetworkServiceProviderSearch.entity().getPhysicalNetworkId(), Op.EQ);
- physicalNetworkServiceProviderSearch.and("serviceProvderType", physicalNetworkServiceProviderSearch.entity().getProviderName(), Op.EQ);
- physicalNetworkServiceProviderSearch.done();
-
- AllFieldsSearch = createSearchBuilder();
- AllFieldsSearch.and("physicalNetworkId", AllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ);
- AllFieldsSearch.and("serviceProvderType", AllFieldsSearch.entity().getProviderName(), Op.EQ);
- AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), Op.EQ);
- AllFieldsSearch.and("vpnService", AllFieldsSearch.entity().isVpnServiceProvided(), Op.EQ);
- AllFieldsSearch.and("dhcpService", AllFieldsSearch.entity().isDhcpServiceProvided(), Op.EQ);
- AllFieldsSearch.and("dnsService", AllFieldsSearch.entity().isDnsServiceProvided(), Op.EQ);
- AllFieldsSearch.and("gatewayService", AllFieldsSearch.entity().isGatewayServiceProvided(), Op.EQ);
- AllFieldsSearch.and("firewallService", AllFieldsSearch.entity().isFirewallServiceProvided(), Op.EQ);
- AllFieldsSearch.and("sourceNatService", AllFieldsSearch.entity().isSourcenatServiceProvided(), Op.EQ);
- AllFieldsSearch.and("lbService", AllFieldsSearch.entity().isLbServiceProvided(), Op.EQ);
- AllFieldsSearch.and("staticNatService", AllFieldsSearch.entity().isStaticnatServiceProvided(), Op.EQ);
- AllFieldsSearch.and("pfService", AllFieldsSearch.entity().isPortForwardingServiceProvided(), Op.EQ);
- AllFieldsSearch.and("userDataService", AllFieldsSearch.entity().isUserdataServiceProvided(), Op.EQ);
- AllFieldsSearch.and("securityGroupService", AllFieldsSearch.entity().isSecuritygroupServiceProvided(), Op.EQ);
- AllFieldsSearch.done();
- }
-
- @Override
- public List<PhysicalNetworkServiceProviderVO> listBy(long physicalNetworkId) {
- SearchCriteria<PhysicalNetworkServiceProviderVO> sc = physicalNetworkSearch.create();
- sc.setParameters("physicalNetworkId", physicalNetworkId);
- return search(sc, null);
- }
-
- @Override
- public PhysicalNetworkServiceProviderVO findByServiceProvider(long physicalNetworkId, String providerType) {
- SearchCriteria<PhysicalNetworkServiceProviderVO> sc = physicalNetworkServiceProviderSearch.create();
- sc.setParameters("physicalNetworkId", physicalNetworkId);
- sc.setParameters("serviceProvderType", providerType);
- return findOneBy(sc);
- }
-
- @Override
- public void deleteProviders(long physicalNetworkId) {
- SearchCriteria<PhysicalNetworkServiceProviderVO> sc = physicalNetworkSearch.create();
- sc.setParameters("physicalNetworkId", physicalNetworkId);
- remove(sc);
- }
-
- @Override
- public boolean isServiceProviderEnabled(long physicalNetworkId, String providerType, String serviceType) {
- SearchCriteria<PhysicalNetworkServiceProviderVO> sc = AllFieldsSearch.create();
- sc.setParameters("physicalNetworkId", physicalNetworkId);
- sc.setParameters("serviceProvderType", providerType);
- sc.setParameters("state", PhysicalNetworkServiceProvider.State.Enabled.toString());
-
- if (serviceType.equalsIgnoreCase(Service.Dhcp.getName())) {
- sc.setParameters("dhcpService", true);
- } else if (serviceType.equalsIgnoreCase(Service.Dns.getName())) {
- sc.setParameters("dnsService", true);
- }else if (serviceType.equalsIgnoreCase(Service.Firewall.getName())) {
- sc.setParameters("firewallService", true);
- }else if (serviceType.equalsIgnoreCase(Service.Gateway.getName())) {
- sc.setParameters("gatewayService", true);
- }else if (serviceType.equalsIgnoreCase(Service.Lb.getName())) {
- sc.setParameters("lbService", true);
- }else if (serviceType.equalsIgnoreCase(Service.PortForwarding.getName())) {
- sc.setParameters("pfService", true);
- }else if (serviceType.equalsIgnoreCase(Service.SecurityGroup.getName())) {
- sc.setParameters("securityGroupService", true);
- }else if (serviceType.equalsIgnoreCase(Service.SourceNat.getName())) {
- sc.setParameters("sourceNatService", true);
- }else if (serviceType.equalsIgnoreCase(Service.StaticNat.getName())) {
- sc.setParameters("staticNatService", true);
- }else if (serviceType.equalsIgnoreCase(Service.UserData.getName())) {
- sc.setParameters("userDataService", true);
- }else if (serviceType.equalsIgnoreCase(Service.Vpn.getName())) {
- sc.setParameters("vpnService", true);
- }
-
- PhysicalNetworkServiceProviderVO map = findOneBy(sc);
-
- if (map != null) {
- return true;
- } else {
- return false;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/network/dao/PhysicalNetworkServiceProviderVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/dao/PhysicalNetworkServiceProviderVO.java b/server/src/com/cloud/network/dao/PhysicalNetworkServiceProviderVO.java
deleted file mode 100644
index 370e498..0000000
--- a/server/src/com/cloud/network/dao/PhysicalNetworkServiceProviderVO.java
+++ /dev/null
@@ -1,322 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.network.dao;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-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.Network.Service;
-import com.cloud.network.PhysicalNetworkServiceProvider;
-import com.cloud.utils.db.GenericDao;
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name = "physical_network_service_providers")
-public class PhysicalNetworkServiceProviderVO implements PhysicalNetworkServiceProvider, InternalIdentity {
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id")
- private long id;
-
- @Column(name="uuid")
- private String uuid;
-
- @Column(name = "physical_network_id")
- private long physicalNetworkId;
-
- @Column(name = "destination_physical_network_id")
- private long destPhysicalNetworkId;
-
- @Column(name = "provider_name")
- private String providerName;
-
- @Column(name="state")
- @Enumerated(value=EnumType.STRING)
- State state;
-
- @Column(name = "vpn_service_provided")
- boolean vpnServiceProvided;
-
- @Column(name = "dhcp_service_provided")
- boolean dhcpServiceProvided;
-
- @Column(name = "dns_service_provided")
- boolean dnsServiceProvided;
-
- @Column(name = "gateway_service_provided")
- boolean gatewayServiceProvided;
-
- @Column(name = "firewall_service_provided")
- boolean firewallServiceProvided;
-
- @Column(name = "source_nat_service_provided")
- boolean sourcenatServiceProvided;
-
- @Column(name = "load_balance_service_provided")
- boolean lbServiceProvided;
-
- @Column(name = "static_nat_service_provided")
- boolean staticnatServiceProvided;
-
- @Column(name = "port_forwarding_service_provided")
- boolean portForwardingServiceProvided;
-
- @Column(name = "user_data_service_provided")
- boolean userdataServiceProvided;
-
- @Column(name = "security_group_service_provided")
- boolean securitygroupServiceProvided;
-
- @Column(name = "networkacl_service_provided")
- boolean networkAclServiceProvided;
-
- @Column(name=GenericDao.REMOVED_COLUMN)
- Date removed;
-
- public PhysicalNetworkServiceProviderVO() {
- }
-
- public PhysicalNetworkServiceProviderVO(long physicalNetworkId, String name) {
- this.physicalNetworkId = physicalNetworkId;
- this.providerName = name;
- this.state = State.Disabled;
- this.uuid = UUID.randomUUID().toString();
- }
-
- @Override
- public long getId() {
- return id;
- }
-
- @Override
- public long getPhysicalNetworkId() {
- return physicalNetworkId;
- }
-
-
- @Override
- public State getState() {
- return state;
- }
-
- @Override
- public void setState(State state) {
- this.state = state;
- }
-
- @Override
- public String getProviderName() {
- return providerName;
- }
-
- public void setDestinationPhysicalNetworkId(long destPhysicalNetworkId) {
- this.destPhysicalNetworkId = destPhysicalNetworkId;
- }
-
- @Override
- public long getDestinationPhysicalNetworkId() {
- return destPhysicalNetworkId;
- }
-
- @Override
- public boolean isVpnServiceProvided() {
- return vpnServiceProvided;
- }
-
- public void setVpnServiceProvided(boolean vpnServiceProvided) {
- this.vpnServiceProvided = vpnServiceProvided;
- }
-
- @Override
- public boolean isDhcpServiceProvided() {
- return dhcpServiceProvided;
- }
-
- public void setDhcpServiceProvided(boolean dhcpServiceProvided) {
- this.dhcpServiceProvided = dhcpServiceProvided;
- }
-
- @Override
- public boolean isDnsServiceProvided() {
- return dnsServiceProvided;
- }
-
- public void setDnsServiceProvided(boolean dnsServiceProvided) {
- this.dnsServiceProvided = dnsServiceProvided;
- }
-
- @Override
- public boolean isGatewayServiceProvided() {
- return gatewayServiceProvided;
- }
-
- public void setGatewayServiceProvided(boolean gatewayServiceProvided) {
- this.gatewayServiceProvided = gatewayServiceProvided;
- }
-
- @Override
- public boolean isFirewallServiceProvided() {
- return firewallServiceProvided;
- }
-
- public void setFirewallServiceProvided(boolean firewallServiceProvided) {
- this.firewallServiceProvided = firewallServiceProvided;
- }
-
- @Override
- public boolean isSourcenatServiceProvided() {
- return sourcenatServiceProvided;
- }
-
- public void setSourcenatServiceProvided(boolean sourcenatServiceProvided) {
- this.sourcenatServiceProvided = sourcenatServiceProvided;
- }
-
- @Override
- public boolean isLbServiceProvided() {
- return lbServiceProvided;
- }
-
- public void setLbServiceProvided(boolean lbServiceProvided) {
- this.lbServiceProvided = lbServiceProvided;
- }
-
- public boolean isStaticnatServiceProvided() {
- return staticnatServiceProvided;
- }
-
- public void setStaticnatServiceProvided(boolean staticnatServiceProvided) {
- this.staticnatServiceProvided = staticnatServiceProvided;
- }
-
- public boolean isPortForwardingServiceProvided() {
- return portForwardingServiceProvided;
- }
-
- public void setPortForwardingServiceProvided(boolean portForwardingServiceProvided) {
- this.portForwardingServiceProvided = portForwardingServiceProvided;
- }
-
- @Override
- public boolean isUserdataServiceProvided() {
- return userdataServiceProvided;
- }
-
- public void setUserdataServiceProvided(boolean userdataServiceProvided) {
- this.userdataServiceProvided = userdataServiceProvided;
- }
-
- @Override
- public boolean isSecuritygroupServiceProvided() {
- return securitygroupServiceProvided;
- }
-
- public void setSecuritygroupServiceProvided(boolean securitygroupServiceProvided) {
- this.securitygroupServiceProvided = securitygroupServiceProvided;
- }
-
- @Override
- public String getUuid() {
- return this.uuid;
- }
-
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- public Date getRemoved() {
- return removed;
- }
-
- public void setRemoved(Date removed) {
- this.removed = removed;
- }
-
- public void setEnabledServices(List<Service> services){
- this.setVpnServiceProvided(services.contains(Service.Vpn));
- this.setDhcpServiceProvided(services.contains(Service.Dhcp));
- this.setDnsServiceProvided(services.contains(Service.Dns));
- this.setGatewayServiceProvided(services.contains(Service.Gateway));
- this.setFirewallServiceProvided(services.contains(Service.Firewall));
- this.setLbServiceProvided(services.contains(Service.Lb));
- this.setSourcenatServiceProvided(services.contains(Service.SourceNat));
- this.setStaticnatServiceProvided(services.contains(Service.StaticNat));
- this.setPortForwardingServiceProvided(services.contains(Service.PortForwarding));
- this.setUserdataServiceProvided(services.contains(Service.UserData));
- this.setSecuritygroupServiceProvided(services.contains(Service.SecurityGroup));
- this.setNetworkAclServiceProvided(services.contains(Service.NetworkACL));
- }
-
- @Override
- public List<Service> getEnabledServices(){
- List<Service> services = new ArrayList<Service>();
- if(this.isVpnServiceProvided()){
- services.add(Service.Vpn);
- }
- if(this.isDhcpServiceProvided()){
- services.add(Service.Dhcp);
- }
- if(this.isDnsServiceProvided()){
- services.add(Service.Dns);
- }
- if(this.isGatewayServiceProvided()){
- services.add(Service.Gateway);
- }
- if(this.isFirewallServiceProvided()){
- services.add(Service.Firewall);
- }
- if(this.isLbServiceProvided()){
- services.add(Service.Lb);
- }
- if(this.sourcenatServiceProvided){
- services.add(Service.SourceNat);
- }
- if(this.staticnatServiceProvided){
- services.add(Service.StaticNat);
- }
- if(this.portForwardingServiceProvided){
- services.add(Service.PortForwarding);
- }
- if(this.isUserdataServiceProvided()){
- services.add(Service.UserData);
- }
- if(this.isSecuritygroupServiceProvided()){
- services.add(Service.SecurityGroup);
- }
- return services;
- }
-
- @Override
- public boolean isNetworkAclServiceProvided() {
- return networkAclServiceProvided;
- }
-
- public void setNetworkAclServiceProvided(boolean networkAclServiceProvided) {
- this.networkAclServiceProvided = networkAclServiceProvided;
- }
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/network/dao/PhysicalNetworkTagDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/dao/PhysicalNetworkTagDaoImpl.java b/server/src/com/cloud/network/dao/PhysicalNetworkTagDaoImpl.java
deleted file mode 100644
index c3e9f73..0000000
--- a/server/src/com/cloud/network/dao/PhysicalNetworkTagDaoImpl.java
+++ /dev/null
@@ -1,63 +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 PhysicalNetworkTagDaoImpl extends GenericDaoBase<PhysicalNetworkTagVO, Long> implements GenericDao<PhysicalNetworkTagVO, Long> {
- private final GenericSearchBuilder<PhysicalNetworkTagVO, String> TagSearch;
- private final SearchBuilder<PhysicalNetworkTagVO> AllFieldsSearch;
-
- protected PhysicalNetworkTagDaoImpl() {
- super();
- TagSearch = createSearchBuilder(String.class);
- TagSearch.selectField(TagSearch.entity().getTag());
- TagSearch.and("physicalNetworkId", TagSearch.entity().getPhysicalNetworkId(), Op.EQ);
- TagSearch.done();
-
- AllFieldsSearch = createSearchBuilder();
- AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), Op.EQ);
- AllFieldsSearch.and("physicalNetworkId", AllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ);
- AllFieldsSearch.and("tag", AllFieldsSearch.entity().getTag(), Op.EQ);
- AllFieldsSearch.done();
- }
-
- public List<String> getTags(long physicalNetworkId) {
- SearchCriteria<String> sc = TagSearch.create();
- sc.setParameters("physicalNetworkId", physicalNetworkId);
-
- return customSearch(sc, null);
- }
-
- public int clearTags(long physicalNetworkId) {
- SearchCriteria<PhysicalNetworkTagVO> sc = AllFieldsSearch.create();
- sc.setParameters("physicalNetworkId", physicalNetworkId);
-
- return remove(sc);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/network/dao/PhysicalNetworkTagVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/dao/PhysicalNetworkTagVO.java b/server/src/com/cloud/network/dao/PhysicalNetworkTagVO.java
deleted file mode 100644
index 787c049..0000000
--- a/server/src/com/cloud/network/dao/PhysicalNetworkTagVO.java
+++ /dev/null
@@ -1,68 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.network.dao;
-
-import org.apache.cloudstack.api.InternalIdentity;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-/**
- *
- */
-@Entity
-@Table(name = "physical_network_tags")
-public class PhysicalNetworkTagVO implements InternalIdentity {
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id")
- private long id;
-
- @Column(name = "physical_network_id")
- private long physicalNetworkId;
-
- @Column(name = "tag")
- private String tag;
-
- /**
- * There should never be a public constructor for this class. Since it's
- * only here to define the table for the DAO class.
- */
- protected PhysicalNetworkTagVO() {
- }
-
- protected PhysicalNetworkTagVO(long physicalNetworkId, String tag) {
- this.physicalNetworkId = physicalNetworkId;
- this.tag = tag;
- }
-
- public long getId() {
- return id;
- }
-
- public long getPhysicalNetworkId() {
- return physicalNetworkId;
- }
-
- public String getTag() {
- return tag;
- }
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeDao.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeDao.java b/server/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeDao.java
deleted file mode 100644
index 42e5b4e..0000000
--- a/server/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeDao.java
+++ /dev/null
@@ -1,33 +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.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.network.Networks.TrafficType;
-import com.cloud.utils.Pair;
-import com.cloud.utils.db.GenericDao;
-
-public interface PhysicalNetworkTrafficTypeDao extends GenericDao<PhysicalNetworkTrafficTypeVO, Long> {
- Pair<List<PhysicalNetworkTrafficTypeVO>, Integer> listAndCountBy(long physicalNetworkId);
- boolean isTrafficTypeSupported(long physicalNetworkId, TrafficType trafficType);
- String getNetworkTag (long physicalNetworkId, TrafficType trafficType, HypervisorType hType);
- PhysicalNetworkTrafficTypeVO findBy(long physicalNetworkId, TrafficType trafficType);
- void deleteTrafficTypes(long physicalNetworkId);
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeDaoImpl.java b/server/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeDaoImpl.java
deleted file mode 100755
index 7e47239..0000000
--- a/server/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeDaoImpl.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.List;
-
-import javax.ejb.Local;
-
-import org.springframework.stereotype.Component;
-
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.network.Networks.TrafficType;
-import com.cloud.utils.Pair;
-import com.cloud.utils.db.DB;
-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
-@Local(value=PhysicalNetworkTrafficTypeDao.class) @DB(txn=false)
-public class PhysicalNetworkTrafficTypeDaoImpl extends GenericDaoBase<PhysicalNetworkTrafficTypeVO, Long> implements PhysicalNetworkTrafficTypeDao {
- final SearchBuilder<PhysicalNetworkTrafficTypeVO> physicalNetworkSearch;
- final GenericSearchBuilder<PhysicalNetworkTrafficTypeVO, String> kvmAllFieldsSearch;
- final GenericSearchBuilder<PhysicalNetworkTrafficTypeVO, String> xenAllFieldsSearch;
- final GenericSearchBuilder<PhysicalNetworkTrafficTypeVO, String> vmWareAllFieldsSearch;
- final GenericSearchBuilder<PhysicalNetworkTrafficTypeVO, String> simulatorAllFieldsSearch;
- final GenericSearchBuilder<PhysicalNetworkTrafficTypeVO, String> ovmAllFieldsSearch;
-
- protected PhysicalNetworkTrafficTypeDaoImpl() {
- super();
- physicalNetworkSearch = createSearchBuilder();
- physicalNetworkSearch.and("physicalNetworkId", physicalNetworkSearch.entity().getPhysicalNetworkId(), Op.EQ);
- physicalNetworkSearch.and("trafficType", physicalNetworkSearch.entity().getTrafficType(), Op.EQ);
- physicalNetworkSearch.done();
-
- kvmAllFieldsSearch = createSearchBuilder(String.class);
- kvmAllFieldsSearch.and("physicalNetworkId", kvmAllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ);
- kvmAllFieldsSearch.and("trafficType", kvmAllFieldsSearch.entity().getTrafficType(), Op.EQ);
- kvmAllFieldsSearch.selectField(kvmAllFieldsSearch.entity().getKvmNetworkLabel());
- kvmAllFieldsSearch.done();
-
- xenAllFieldsSearch = createSearchBuilder(String.class);
- xenAllFieldsSearch.and("physicalNetworkId", xenAllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ);
- xenAllFieldsSearch.and("trafficType", xenAllFieldsSearch.entity().getTrafficType(), Op.EQ);
- xenAllFieldsSearch.selectField(xenAllFieldsSearch.entity().getXenNetworkLabel());
- xenAllFieldsSearch.done();
-
- vmWareAllFieldsSearch = createSearchBuilder(String.class);
- vmWareAllFieldsSearch.and("physicalNetworkId", vmWareAllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ);
- vmWareAllFieldsSearch.and("trafficType", vmWareAllFieldsSearch.entity().getTrafficType(), Op.EQ);
- vmWareAllFieldsSearch.selectField(vmWareAllFieldsSearch.entity().getVmwareNetworkLabel());
- vmWareAllFieldsSearch.done();
-
- simulatorAllFieldsSearch = createSearchBuilder(String.class);
- simulatorAllFieldsSearch.and("physicalNetworkId", simulatorAllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ);
- simulatorAllFieldsSearch.and("trafficType", simulatorAllFieldsSearch.entity().getTrafficType(), Op.EQ);
- simulatorAllFieldsSearch.selectField(simulatorAllFieldsSearch.entity().getSimulatorNetworkLabel());
- simulatorAllFieldsSearch.done();
-
- ovmAllFieldsSearch = createSearchBuilder(String.class);
- ovmAllFieldsSearch.and("physicalNetworkId", ovmAllFieldsSearch.entity().getPhysicalNetworkId(), Op.EQ);
- ovmAllFieldsSearch.and("trafficType", ovmAllFieldsSearch.entity().getTrafficType(), Op.EQ);
- ovmAllFieldsSearch.selectField(ovmAllFieldsSearch.entity().getSimulatorNetworkLabel());
- ovmAllFieldsSearch.done();
- }
-
- @Override
- public Pair<List<PhysicalNetworkTrafficTypeVO>, Integer> listAndCountBy(long physicalNetworkId) {
- SearchCriteria<PhysicalNetworkTrafficTypeVO> sc = physicalNetworkSearch.create();
- sc.setParameters("physicalNetworkId", physicalNetworkId);
- return searchAndCount(sc, null);
- }
-
- @Override
- public boolean isTrafficTypeSupported(long physicalNetworkId, TrafficType trafficType){
- SearchCriteria<PhysicalNetworkTrafficTypeVO> sc = physicalNetworkSearch.create();
- sc.setParameters("physicalNetworkId", physicalNetworkId);
- sc.setParameters("trafficType", trafficType);
- if (findOneBy(sc) != null) {
- return true;
- } else {
- return false;
- }
- }
-
- @Override
- public String getNetworkTag(long physicalNetworkId, TrafficType trafficType, HypervisorType hType) {
- SearchCriteria<String> sc = null;
- if (hType == HypervisorType.XenServer) {
- sc = xenAllFieldsSearch.create();
- } else if (hType == HypervisorType.KVM) {
- sc = kvmAllFieldsSearch.create();
- } else if (hType == HypervisorType.VMware) {
- sc = vmWareAllFieldsSearch.create();
- } else if (hType == HypervisorType.Simulator) {
- sc = simulatorAllFieldsSearch.create();
- } else if (hType == HypervisorType.Ovm) {
- sc = ovmAllFieldsSearch.create();
- } else if (hType == HypervisorType.BareMetal) {
- return null;
- } else {
- assert(false) : "We don't handle this hypervisor type";
- return null;
- }
-
- sc.setParameters("physicalNetworkId", physicalNetworkId);
- sc.setParameters("trafficType", trafficType);
- List<String> tag = customSearch(sc, null);
-
- return tag.size() == 0 ? null : tag.get(0);
- }
-
- @Override
- public PhysicalNetworkTrafficTypeVO findBy(long physicalNetworkId, TrafficType trafficType){
- SearchCriteria<PhysicalNetworkTrafficTypeVO> sc = physicalNetworkSearch.create();
- sc.setParameters("physicalNetworkId", physicalNetworkId);
- sc.setParameters("trafficType", trafficType);
- return findOneBy(sc);
- }
-
- @Override
- public void deleteTrafficTypes(long physicalNetworkId) {
- SearchCriteria<PhysicalNetworkTrafficTypeVO> sc = physicalNetworkSearch.create();
- sc.setParameters("physicalNetworkId", physicalNetworkId);
- remove(sc);
- }
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeVO.java b/server/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeVO.java
deleted file mode 100644
index 4c32d0a..0000000
--- a/server/src/com/cloud/network/dao/PhysicalNetworkTrafficTypeVO.java
+++ /dev/null
@@ -1,149 +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.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.Networks.TrafficType;
-import com.cloud.network.PhysicalNetworkTrafficType;
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name = "physical_network_traffic_types")
-public class PhysicalNetworkTrafficTypeVO implements PhysicalNetworkTrafficType {
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id")
- private long id;
-
- @Column(name="uuid")
- private String uuid;
-
- @Column(name = "physical_network_id")
- private long physicalNetworkId;
-
- @Column(name="traffic_type")
- @Enumerated(value=EnumType.STRING)
- TrafficType trafficType;
-
- @Column(name = "xen_network_label")
- private String xenNetworkLabel;
-
- @Column(name = "kvm_network_label")
- private String kvmNetworkLabel;
-
- @Column(name = "vmware_network_label")
- private String vmwareNetworkLabel;
-
- @Column(name = "simulator_network_label")
- private String simulatorNetworkLabel;
-
- @Column(name = "vlan")
- private String vlan;
-
- public PhysicalNetworkTrafficTypeVO() {
- }
-
- public PhysicalNetworkTrafficTypeVO(long physicalNetworkId, TrafficType trafficType, String xenLabel, String kvmLabel, String vmwareLabel, String simulatorLabel, String vlan) {
- this.physicalNetworkId = physicalNetworkId;
- this.trafficType = trafficType;
- this.xenNetworkLabel = xenLabel;
- this.kvmNetworkLabel = kvmLabel;
- this.vmwareNetworkLabel = vmwareLabel;
- this.simulatorNetworkLabel = simulatorLabel;
- this.setVlan(vlan);
- this.uuid = UUID.randomUUID().toString();
- }
-
- @Override
- public long getId() {
- return id;
- }
-
- @Override
- public long getPhysicalNetworkId() {
- return physicalNetworkId;
- }
-
- @Override
- public TrafficType getTrafficType() {
- return trafficType;
- }
-
- public void setXenNetworkLabel(String xenNetworkLabel) {
- this.xenNetworkLabel = xenNetworkLabel;
- }
-
- @Override
- public String getXenNetworkLabel() {
- return xenNetworkLabel;
- }
-
- public void setKvmNetworkLabel(String kvmNetworkLabel) {
- this.kvmNetworkLabel = kvmNetworkLabel;
- }
-
- @Override
- public String getKvmNetworkLabel() {
- return kvmNetworkLabel;
- }
-
- public void setVmwareNetworkLabel(String vmwareNetworkLabel) {
- this.vmwareNetworkLabel = vmwareNetworkLabel;
- }
-
- @Override
- public String getVmwareNetworkLabel() {
- return vmwareNetworkLabel;
- }
-
- public void setSimulatorNetworkLabel(String simulatorNetworkLabel) {
- this.simulatorNetworkLabel = simulatorNetworkLabel;
- }
-
- @Override
- public String getSimulatorNetworkLabel() {
- return simulatorNetworkLabel;
- }
-
- public void setVlan(String vlan) {
- this.vlan = vlan;
- }
-
- public String getVlan() {
- return vlan;
- }
-
- @Override
- public String getUuid() {
- return this.uuid;
- }
-
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/network/dao/PhysicalNetworkVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/dao/PhysicalNetworkVO.java b/server/src/com/cloud/network/dao/PhysicalNetworkVO.java
deleted file mode 100644
index f68eee1..0000000
--- a/server/src/com/cloud/network/dao/PhysicalNetworkVO.java
+++ /dev/null
@@ -1,246 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.network.dao;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.UUID;
-
-import javax.persistence.CollectionTable;
-import javax.persistence.Column;
-import javax.persistence.ElementCollection;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.FetchType;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.Table;
-import javax.persistence.TableGenerator;
-
-import com.cloud.network.PhysicalNetwork;
-import com.cloud.utils.NumbersUtil;
-import com.cloud.utils.Pair;
-import com.cloud.utils.db.GenericDao;
-
-/**
- * NetworkConfigurationVO contains information about a specific physical network.
- *
- */
-@Entity
-@Table(name="physical_network")
-public class PhysicalNetworkVO implements PhysicalNetwork {
- @Id
- @TableGenerator(name="physical_networks_sq", table="sequence", pkColumnName="name", valueColumnName="value", pkColumnValue="physical_networks_seq", allocationSize=1)
- @Column(name="id")
- long id;
-
- @Column(name="uuid")
- private String uuid;
-
- @Column(name="name")
- private String name;
-
- @Column(name="data_center_id")
- long dataCenterId;
-
- @Column(name="vnet")
- private String vnet = null;
-
- @Column(name="speed")
- private String speed = null;
-
- @Column(name="domain_id")
- Long domainId = null;
-
- @Column(name="broadcast_domain_range")
- @Enumerated(value=EnumType.STRING)
- BroadcastDomainRange broadcastDomainRange;
-
- @Column(name="state")
- @Enumerated(value=EnumType.STRING)
- State state;
-
- @Column(name=GenericDao.REMOVED_COLUMN)
- Date removed;
-
- @Column(name=GenericDao.CREATED_COLUMN)
- Date created;
-
- @ElementCollection(targetClass = String.class, fetch=FetchType.EAGER)
- @Column(name="tag")
- @CollectionTable(name="physical_network_tags", joinColumns=@JoinColumn(name="physical_network_id"))
- List<String> tags;
-
- @ElementCollection(targetClass = String.class, fetch=FetchType.EAGER)
- @Column(name="isolation_method")
- @CollectionTable(name="physical_network_isolation_methods", joinColumns=@JoinColumn(name="physical_network_id"))
- List<String> isolationMethods;
-
- public PhysicalNetworkVO(){
-
- }
-
- public PhysicalNetworkVO(long id, long dataCenterId, String vnet, String speed, Long domainId, BroadcastDomainRange broadcastDomainRange, String name) {
- this.dataCenterId = dataCenterId;
- this.setVnet(vnet);
- this.setSpeed(speed);
- this.domainId = domainId;
- if(broadcastDomainRange != null){
- this.broadcastDomainRange = broadcastDomainRange;
- }else{
- this.broadcastDomainRange = BroadcastDomainRange.POD;
- }
- this.state = State.Disabled;
- this.uuid = UUID.randomUUID().toString();
- this.name = name;
- this.id = id;
- }
-
- @Override
- public State getState() {
- return state;
- }
-
- public void setState(State state) {
- this.state = state;
- }
-
- @Override
- public long getId() {
- return id;
- }
-
- @Override
- public List<String> getTags() {
- return tags != null ? tags : new ArrayList<String>();
- }
-
- public void addTag(String tag) {
- if (tags == null) {
- tags = new ArrayList<String>();
- }
- tags.add(tag);
- }
-
- public void setTags(List<String> tags) {
- this.tags = tags;
- }
-
- @Override
- public Long getDomainId() {
- return domainId;
- }
-
- @Override
- public BroadcastDomainRange getBroadcastDomainRange() {
- return broadcastDomainRange;
- }
-
- public void setBroadcastDomainRange(BroadcastDomainRange broadcastDomainRange) {
- this.broadcastDomainRange = broadcastDomainRange;
- }
-
- @Override
- public int hashCode() {
- return NumbersUtil.hash(id);
- }
-
- @Override
- public long getDataCenterId() {
- return dataCenterId;
- }
-
- public Date getRemoved() {
- return removed;
- }
-
- public void setRemoved(Date removed) {
- this.removed = removed;
- }
-
- public Date getCreated() {
- return created;
- }
-
- public void setCreated(Date created) {
- this.created = created;
- }
-
- @Override
- public List<String> getIsolationMethods() {
- return isolationMethods != null ? isolationMethods : new ArrayList<String>();
- }
-
- public void addIsolationMethod(String isolationMethod) {
- if (isolationMethods == null) {
- isolationMethods = new ArrayList<String>();
- }
- isolationMethods.add(isolationMethod);
- }
-
- public void setIsolationMethods(List<String> isolationMethods) {
- this.isolationMethods = isolationMethods;
- }
-
- public void setVnet(String vnet) {
- this.vnet = vnet;
- }
-
- @Override
- public List<Pair<Integer, Integer>> getVnet() {
- List <Pair<Integer,Integer>> vnetList = new ArrayList<Pair<Integer, Integer>>();
- if (vnet != null) {
- String [] Temp = vnet.split(";");
- String [] vnetSplit = null;
- for (String vnetRange : Temp){
- vnetSplit = vnetRange.split("-");
- vnetList.add(new Pair<Integer,Integer>(Integer.parseInt(vnetSplit[0]),Integer.parseInt(vnetSplit[1])));
- }
- }
- return vnetList;
- }
-
- @Override
- public String getVnetString() {
- return vnet;
- }
-
- public void setSpeed(String speed) {
- this.speed = speed;
- }
-
- @Override
- public String getSpeed() {
- return speed;
- }
-
- @Override
- public String getUuid() {
- return this.uuid;
- }
-
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- @Override
- public String getName() {
- return name;
- }
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/network/dao/PortProfileDao.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/dao/PortProfileDao.java b/server/src/com/cloud/network/dao/PortProfileDao.java
deleted file mode 100644
index 5ecd8f4..0000000
--- a/server/src/com/cloud/network/dao/PortProfileDao.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 java.util.List;
-import com.cloud.utils.db.GenericDao;
-
-public interface PortProfileDao extends GenericDao<PortProfileVO, Long> {
-
- /**
- * Return a Port Profile VO (db record) given its name.
- */
- PortProfileVO findByName(String portProfileName);
-
- /*
- * Returns true if there already is any portprofile that trunks
- * vlan IDs in a specified range.
- */
- boolean doesVlanRangeClash(int lowVlanId, int highVlanId);
-
- /*
- * Return a list of port profiles that have the specified access vlanID.
- */
- List<PortProfileVO> listByVlanId(int vlanId);
-
- /**
- * Other candidate functions that could be helpful.
- *
- * List all portprofiles configured with a particular id.
- * List<PortProfileVO> listByVlanId(int vlanId);
- *
- * List all uplink portprofiles (these represent physical ports).
- * List<PortProfileVO> listAllUplinkPortProfiles(); // we may have to provide some filter, like clusterId or zoneId or something.
- *
- */
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/network/dao/PortProfileDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/dao/PortProfileDaoImpl.java b/server/src/com/cloud/network/dao/PortProfileDaoImpl.java
deleted file mode 100644
index 61fe52a..0000000
--- a/server/src/com/cloud/network/dao/PortProfileDaoImpl.java
+++ /dev/null
@@ -1,89 +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.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.List;
-import javax.ejb.Local;
-
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-
-import com.cloud.utils.db.DB;
-import com.cloud.utils.db.GenericDaoBase;
-import com.cloud.utils.db.SearchBuilder;
-import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.db.Transaction;
-import com.cloud.utils.db.SearchCriteria.Op;
-import com.cloud.utils.exception.CloudRuntimeException;
-
-@Component
-@Local(value=PortProfileDao.class) @DB(txn=false)
-public class PortProfileDaoImpl extends GenericDaoBase<PortProfileVO, Long> implements PortProfileDao {
- protected static final Logger s_logger = Logger.getLogger(PortProfileDaoImpl.class);
-
- final SearchBuilder<PortProfileVO> nameSearch;
- final SearchBuilder<PortProfileVO> accessVlanSearch;
-
- public PortProfileDaoImpl() {
- super();
-
- nameSearch = createSearchBuilder();
- nameSearch.and("portProfileName", nameSearch.entity().getPortProfileName(), Op.EQ);
- nameSearch.done();
-
- accessVlanSearch = createSearchBuilder();
- accessVlanSearch.and("accessVlanId", accessVlanSearch.entity().getAccessVlanId(), Op.EQ);
- accessVlanSearch.done();
- }
-
- public PortProfileVO findByName(String portProfileName) {
- SearchCriteria<PortProfileVO> sc = nameSearch.create();
- sc.setParameters("portProfileName", portProfileName);
- return findOneBy(sc);
- }
-
- @DB
- public boolean doesVlanRangeClash(int lowVlanId, int highVlanId) {
- String dbName = "cloud";
- String tableName = "port_profile";
- String condition = "(trunk_low_vlan_id BETWEEN " + lowVlanId + " AND " + highVlanId + ")" + " OR (trunk_high_vlan_id BETWEEN " + lowVlanId + " AND " + highVlanId + ")";
- String selectSql = "SELECT * FROM `" + dbName + "`.`" + tableName + "` WHERE " + condition;
-
- Transaction txn = Transaction.currentTxn();
- try {
- PreparedStatement stmt = txn.prepareAutoCloseStatement(selectSql);
- ResultSet rs = stmt.executeQuery();
- if (rs != null && rs.next()) {
- // There are records that contain vlans in this range, so return true
- return true;
- }
- } catch (SQLException ex) {
- throw new CloudRuntimeException("Failed to execute SQL query to check for vlan range clash");
- }
- return false;
- }
-
- public List<PortProfileVO> listByVlanId(int vlanId) {
- SearchCriteria<PortProfileVO> sc = accessVlanSearch.create();
- sc.setParameters("accessVlanId", vlanId);
- return search(sc, null);
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/network/dao/PortProfileVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/dao/PortProfileVO.java b/server/src/com/cloud/network/dao/PortProfileVO.java
deleted file mode 100644
index 6227348..0000000
--- a/server/src/com/cloud/network/dao/PortProfileVO.java
+++ /dev/null
@@ -1,204 +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.exception.InvalidParameterValueException;
-import org.apache.cloudstack.api.InternalIdentity;
-
-/**
- * PortProfileVO contains information on portprofiles that are created on a Cisco Nexus 1000v VSM associated
- * with a VMWare cluster.
- */
-
-@Entity
-@Table(name="port_profile")
-public class PortProfileVO implements InternalIdentity {
-
- // We need to know what properties a VSM has. Put them here.
-
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id")
- private long id;
-
- @Column(name="uuid")
- private String uuid;
-
- @Column(name = "port_profile_name")
- private String portProfileName;
-
- @Column(name = "port_mode")
- private PortMode portMode;
-
- @Column(name = "vsm_id")
- private long vsmId;
-
- @Column(name = "trunk_low_vlan_id")
- private int lowVlanId;
-
- @Column(name = "trunk_high_vlan_id")
- private int highVlanId;
-
- @Column(name = "access_vlan_id")
- private int accessVlanId;
-
- @Column(name = "port_type")
- private PortType portType;
-
- @Column(name = "port_binding")
- private BindingType portBinding;
-
- public enum BindingType {
- Static,
- Ephemeral
- }
-
- public enum PortType {
- Ethernet,
- vEthernet
- }
-
- // This tells us whether the port trunks multiple VLANs
- // or carries traffic of a single VLAN.
- public enum PortMode {
- Access,
- Trunk
- }
-
- // Accessor methods
- public long getId() {
- return id;
- }
-
- public String getUuid() {
- return uuid;
- }
-
- public String getPortProfileName() {
- return portProfileName;
- }
-
- public PortMode getPortMode() {
- return portMode;
- }
-
- public long getVsmId() {
- return vsmId;
- }
-
- public int getLowVlanId() {
- return lowVlanId;
- }
-
- public int getHighVlanId() {
- return highVlanId;
- }
-
- public int getAccessVlanId() {
- return accessVlanId;
- }
-
- public PortType getPortType() {
- return portType;
- }
-
- public BindingType getPortBinding() {
- return portBinding;
- }
-
- // Setter methods
-
- public void setPortProfileName(String name) {
- portProfileName = name;
- }
-
- public void setPortMode(PortMode mode) {
- portMode = mode;
- }
-
- public void setVsmId(long id) {
- vsmId = id;
- }
-
- public void setLowVlanId(int vlanId) {
- lowVlanId = vlanId;
- }
-
- public void setHighVlanId(int vlanId) {
- highVlanId = vlanId;
- }
-
- public void setAccessVlanId(int vlanId) {
- accessVlanId = vlanId;
- }
-
- public void setPortType(PortType type) {
- portType = type;
- }
-
- public void setPortBinding(BindingType bindingType) {
- portBinding = bindingType;
- }
-
- // Constructor methods.
-
- public PortProfileVO(String portProfName, long vsmId, int vlanId, PortType pType, BindingType bType) {
- // Set the relevant portprofile properties here.
- // When supplied with a single vlanId, we set this portprofile as an access port profile.
-
- this.setPortMode(PortMode.Access);
-
- this.uuid = UUID.randomUUID().toString();
- this.setPortProfileName(portProfName);
- this.setVsmId(vsmId);
- this.setAccessVlanId(vlanId);
- this.setPortType(pType);
- this.setPortBinding(bType);
- }
-
- public PortProfileVO(String portProfName, long vsmId, int lowVlanId, int highVlanId, PortType pType, BindingType bType) {
- // Set the relevant portprofile properties here.
- // When supplied with a vlan range, we set this portprofile as a trunk port profile.
-
- if (lowVlanId >= highVlanId) {
- throw new InvalidParameterValueException("Low Vlan Id cannot be greater than or equal to high Vlan Id");
- }
- this.setPortMode(PortMode.Trunk);
-
- this.uuid = UUID.randomUUID().toString();
- this.setPortProfileName(portProfName);
- this.setVsmId(vsmId);
- this.setLowVlanId(lowVlanId);
- this.setHighVlanId(highVlanId);
- this.setPortType(pType);
- this.setPortBinding(bType);
- }
-
- public PortProfileVO() {
- this.uuid = UUID.randomUUID().toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d015fb35/server/src/com/cloud/network/dao/RemoteAccessVpnDao.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/dao/RemoteAccessVpnDao.java b/server/src/com/cloud/network/dao/RemoteAccessVpnDao.java
deleted file mode 100644
index 6e3b483..0000000
--- a/server/src/com/cloud/network/dao/RemoteAccessVpnDao.java
+++ /dev/null
@@ -1,30 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.network.dao;
-
-import java.util.List;
-
-import com.cloud.network.RemoteAccessVpn;
-import com.cloud.utils.db.GenericDao;
-
-public interface RemoteAccessVpnDao extends GenericDao<RemoteAccessVpnVO, Long> {
- RemoteAccessVpnVO findByPublicIpAddress(long ipAddressId);
- RemoteAccessVpnVO findByPublicIpAddressAndState(long ipAddressId, RemoteAccessVpn.State state);
- RemoteAccessVpnVO findByAccountAndNetwork(Long accountId, Long zoneId);
- List<RemoteAccessVpnVO> findByAccount(Long accountId);
- List<RemoteAccessVpnVO> listByNetworkId(Long networkId);
-}