mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fix a few Spring bootstrap issues
This commit is contained in:
parent
9de3a1fae4
commit
259e6d5f74
@ -66,7 +66,7 @@ import org.apache.cloudstack.storage.image.provider.ImageDataStoreProviderManage
|
||||
import org.apache.cloudstack.storage.image.store.ImageDataStore;
|
||||
import org.apache.cloudstack.storage.image.store.lifecycle.ImageDataStoreLifeCycle;
|
||||
import org.apache.cloudstack.storage.volume.VolumeService;
|
||||
import org.apache.cloudstack.storage.volume.db.VolumeDao;
|
||||
import org.apache.cloudstack.storage.volume.db.VolumeDao2;
|
||||
import org.apache.cloudstack.storage.volume.db.VolumeVO;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.mockito.Mockito;
|
||||
@ -105,7 +105,7 @@ public class volumeServiceTest extends CloudStackTestNGBase {
|
||||
@Inject
|
||||
ImageDataDao imageDataDao;
|
||||
@Inject
|
||||
VolumeDao volumeDao;
|
||||
VolumeDao2 volumeDao;
|
||||
@Inject
|
||||
HostDao hostDao;
|
||||
@Inject
|
||||
|
||||
@ -28,7 +28,7 @@ import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
import com.cloud.utils.fsm.StateDao;
|
||||
|
||||
public interface VolumeDao extends GenericDao<VolumeVO, Long>, StateDao<Volume.State, Volume.Event, VolumeVO> {
|
||||
public interface VolumeDao2 extends GenericDao<VolumeVO, Long>, StateDao<Volume.State, Volume.Event, VolumeVO> {
|
||||
|
||||
List<VolumeVO> findDetachedByAccount(long accountId);
|
||||
|
||||
@ -52,10 +52,10 @@ import com.cloud.utils.db.Transaction;
|
||||
import com.cloud.utils.db.UpdateBuilder;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
@Local(value = VolumeDao.class)
|
||||
@Local(value = VolumeDao2.class)
|
||||
@Component
|
||||
public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements VolumeDao {
|
||||
private static final Logger s_logger = Logger.getLogger(VolumeDaoImpl.class);
|
||||
public class VolumeDao2Impl extends GenericDaoBase<VolumeVO, Long> implements VolumeDao2 {
|
||||
private static final Logger s_logger = Logger.getLogger(VolumeDao2Impl.class);
|
||||
protected final SearchBuilder<VolumeVO> DetachedAccountIdSearch;
|
||||
protected final SearchBuilder<VolumeVO> TemplateZoneSearch;
|
||||
protected final GenericSearchBuilder<VolumeVO, SumCount> TotalSizeByPoolSearch;
|
||||
@ -249,7 +249,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
||||
}
|
||||
}
|
||||
|
||||
protected VolumeDaoImpl() {
|
||||
protected VolumeDao2Impl() {
|
||||
AllFieldsSearch = createSearchBuilder();
|
||||
AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), Op.EQ);
|
||||
AllFieldsSearch.and("accountId", AllFieldsSearch.entity().getAccountId(), Op.EQ);
|
||||
@ -25,7 +25,7 @@ import org.apache.cloudstack.storage.to.VolumeTO;
|
||||
import org.apache.cloudstack.storage.volume.TemplateOnPrimaryDataStoreInfo;
|
||||
import org.apache.cloudstack.storage.volume.TemplatePrimaryDataStoreManager;
|
||||
import org.apache.cloudstack.storage.volume.VolumeObject;
|
||||
import org.apache.cloudstack.storage.volume.db.VolumeDao;
|
||||
import org.apache.cloudstack.storage.volume.db.VolumeDao2;
|
||||
import org.apache.cloudstack.storage.volume.db.VolumeVO;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
@ -46,7 +46,7 @@ public class DefaultPrimaryDataStore implements PrimaryDataStore {
|
||||
private HypervisorType supportedHypervisor;
|
||||
private boolean isLocalStorageSupported = false;
|
||||
@Inject
|
||||
private VolumeDao volumeDao;
|
||||
private VolumeDao2 volumeDao;
|
||||
@Inject
|
||||
private HostDao hostDao;
|
||||
@Inject
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
package org.apache.cloudstack.storage.volume;
|
||||
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeProfile;
|
||||
import org.apache.cloudstack.storage.volume.db.VolumeDao;
|
||||
import org.apache.cloudstack.storage.volume.db.VolumeDao2;
|
||||
import org.apache.cloudstack.storage.volume.db.VolumeVO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -33,7 +33,7 @@ import com.cloud.utils.fsm.StateMachine2;
|
||||
@Component
|
||||
public class VolumeManagerImpl implements VolumeManager {
|
||||
@Inject
|
||||
protected VolumeDao _volumeDao;
|
||||
protected VolumeDao2 _volumeDao;
|
||||
private final static StateMachine2<State, Event, VolumeVO> s_fsm = new StateMachine2<State, Event, VolumeVO>();
|
||||
public VolumeManagerImpl() {
|
||||
initStateMachine();
|
||||
|
||||
@ -11,7 +11,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.disktype.VolumeDiskTyp
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeType;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeTypeHelper;
|
||||
import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
|
||||
import org.apache.cloudstack.storage.volume.db.VolumeDao;
|
||||
import org.apache.cloudstack.storage.volume.db.VolumeDao2;
|
||||
import org.apache.cloudstack.storage.volume.db.VolumeVO;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
@ -34,7 +34,7 @@ public class VolumeObject implements VolumeInfo {
|
||||
@Inject
|
||||
VolumeTypeHelper volumeTypeHelper;
|
||||
@Inject
|
||||
VolumeDao volumeDao;
|
||||
VolumeDao2 volumeDao;
|
||||
@Inject
|
||||
VolumeManager volumeMgr;
|
||||
private VolumeObject(PrimaryDataStore dataStore, VolumeVO volumeVO) {
|
||||
|
||||
@ -33,7 +33,7 @@ import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
|
||||
import org.apache.cloudstack.storage.datastore.manager.PrimaryDataStoreManager;
|
||||
import org.apache.cloudstack.storage.image.TemplateInfo;
|
||||
import org.apache.cloudstack.storage.image.motion.ImageMotionService;
|
||||
import org.apache.cloudstack.storage.volume.db.VolumeDao;
|
||||
import org.apache.cloudstack.storage.volume.db.VolumeDao2;
|
||||
import org.apache.cloudstack.storage.volume.db.VolumeVO;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -48,7 +48,7 @@ import com.cloud.utils.exception.CloudRuntimeException;
|
||||
@Component
|
||||
public class VolumeServiceImpl implements VolumeService {
|
||||
@Inject
|
||||
VolumeDao volDao;
|
||||
VolumeDao2 volDao;
|
||||
@Inject
|
||||
PrimaryDataStoreManager dataStoreMgr;
|
||||
@Inject
|
||||
|
||||
@ -19,6 +19,7 @@ package com.cloud.network.lb.dao;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -40,8 +41,8 @@ import com.cloud.vm.dao.DomainRouterDaoImpl;
|
||||
@Component
|
||||
@Local(value={ElasticLbVmMapDao.class})
|
||||
public class ElasticLbVmMapDaoImpl extends GenericDaoBase<ElasticLbVmMapVO, Long> implements ElasticLbVmMapDao {
|
||||
protected final DomainRouterDao _routerDao = ComponentLocator.inject(DomainRouterDaoImpl.class);
|
||||
protected final LoadBalancerDao _loadbalancerDao = ComponentLocator.inject(LoadBalancerDaoImpl.class);
|
||||
@Inject protected DomainRouterDao _routerDao;
|
||||
@Inject protected LoadBalancerDao _loadbalancerDao;
|
||||
|
||||
|
||||
protected final SearchBuilder<ElasticLbVmMapVO> AllFieldsSearch;
|
||||
|
||||
@ -25,6 +25,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -33,6 +34,7 @@ import com.cloud.capacity.Capacity;
|
||||
import com.cloud.capacity.CapacityVO;
|
||||
import com.cloud.storage.Storage;
|
||||
import com.cloud.storage.StoragePoolVO;
|
||||
import com.cloud.storage.dao.StoragePoolDao;
|
||||
import com.cloud.storage.dao.StoragePoolDaoImpl;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.StringUtils;
|
||||
@ -65,7 +67,7 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
|
||||
private final SearchBuilder<CapacityVO> _hostOrPoolIdSearch;
|
||||
protected GenericSearchBuilder<CapacityVO, SummedCapacity> SummedCapacitySearch;
|
||||
private SearchBuilder<CapacityVO> _allFieldsSearch;
|
||||
protected final StoragePoolDaoImpl _storagePoolDao = ComponentLocator.inject(StoragePoolDaoImpl.class);
|
||||
@Inject protected StoragePoolDao _storagePoolDao;
|
||||
|
||||
|
||||
private static final String LIST_HOSTS_IN_CLUSTER_WITH_ENOUGH_CAPACITY = "SELECT a.host_id FROM (host JOIN op_host_capacity a ON host.id = a.host_id AND host.cluster_id = ? AND host.type = ? " +
|
||||
|
||||
@ -22,6 +22,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -48,8 +49,11 @@ public class ResourceCountDaoImpl extends GenericDaoBase<ResourceCountVO, Long>
|
||||
private SearchBuilder<ResourceCountVO> AccountSearch;
|
||||
private SearchBuilder<ResourceCountVO> DomainSearch;
|
||||
|
||||
protected final DomainDaoImpl _domainDao = ComponentLocator.inject(DomainDaoImpl.class);
|
||||
protected final AccountDaoImpl _accountDao = ComponentLocator.inject(AccountDaoImpl.class);
|
||||
//protected final DomainDaoImpl _domainDao = ComponentLocator.inject(DomainDaoImpl.class);
|
||||
//protected final AccountDaoImpl _accountDao = ComponentLocator.inject(AccountDaoImpl.class);
|
||||
|
||||
@Inject protected DomainDaoImpl _domainDao;
|
||||
@Inject protected AccountDaoImpl _accountDao;
|
||||
|
||||
public ResourceCountDaoImpl() {
|
||||
TypeSearch = createSearchBuilder();
|
||||
|
||||
@ -21,6 +21,7 @@ import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
import javax.persistence.TableGenerator;
|
||||
|
||||
@ -63,16 +64,15 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
|
||||
protected SearchBuilder<DataCenterVO> DisabledZonesSearch;
|
||||
protected SearchBuilder<DataCenterVO> TokenSearch;
|
||||
|
||||
protected final DataCenterIpAddressDaoImpl _ipAllocDao = ComponentLocator.inject(DataCenterIpAddressDaoImpl.class);
|
||||
protected final DataCenterLinkLocalIpAddressDaoImpl _LinkLocalIpAllocDao = ComponentLocator.inject(DataCenterLinkLocalIpAddressDaoImpl.class);
|
||||
protected final DataCenterVnetDaoImpl _vnetAllocDao = ComponentLocator.inject(DataCenterVnetDaoImpl.class);
|
||||
protected final PodVlanDaoImpl _podVlanAllocDao = ComponentLocator.inject(PodVlanDaoImpl.class);
|
||||
@Inject protected final DataCenterIpAddressDaoImpl _ipAllocDao;
|
||||
@Inject protected final DataCenterLinkLocalIpAddressDaoImpl _LinkLocalIpAllocDao;
|
||||
@Inject protected final DataCenterVnetDaoImpl _vnetAllocDao;
|
||||
@Inject protected final PodVlanDaoImpl _podVlanAllocDao;
|
||||
protected long _prefix;
|
||||
protected Random _rand = new Random(System.currentTimeMillis());
|
||||
protected TableGenerator _tgMacAddress;
|
||||
|
||||
protected final DcDetailsDaoImpl _detailsDao = ComponentLocator.inject(DcDetailsDaoImpl.class);
|
||||
|
||||
@Inject protected final DcDetailsDaoImpl _detailsDao;
|
||||
|
||||
@Override
|
||||
public DataCenterVO findByName(String name) {
|
||||
|
||||
@ -26,6 +26,7 @@ import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.persistence.TableGenerator;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
@ -114,10 +115,10 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||
protected final Attribute _msIdAttr;
|
||||
protected final Attribute _pingTimeAttr;
|
||||
|
||||
protected final HostDetailsDaoImpl _detailsDao = ComponentLocator.inject(HostDetailsDaoImpl.class);
|
||||
protected final HostTagsDaoImpl _hostTagsDao = ComponentLocator.inject(HostTagsDaoImpl.class);
|
||||
protected final HostTransferMapDaoImpl _hostTransferDao = ComponentLocator.inject(HostTransferMapDaoImpl.class);
|
||||
protected final ClusterDaoImpl _clusterDao = ComponentLocator.inject(ClusterDaoImpl.class);
|
||||
@Inject protected HostDetailsDaoImpl _detailsDao;
|
||||
@Inject protected HostTagsDaoImpl _hostTagsDao;
|
||||
@Inject protected HostTransferMapDaoImpl _hostTransferDao;
|
||||
@Inject protected ClusterDaoImpl _clusterDao;
|
||||
|
||||
|
||||
public HostDaoImpl() {
|
||||
|
||||
@ -19,6 +19,7 @@ package com.cloud.network.dao;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -54,8 +55,8 @@ public class FirewallRulesDaoImpl extends GenericDaoBase<FirewallRuleVO, Long> i
|
||||
protected final SearchBuilder<FirewallRuleVO> SystemRuleSearch;
|
||||
protected final GenericSearchBuilder<FirewallRuleVO, Long> RulesByIpCount;
|
||||
|
||||
protected final FirewallRulesCidrsDaoImpl _firewallRulesCidrsDao = ComponentLocator.inject(FirewallRulesCidrsDaoImpl.class);
|
||||
ResourceTagsDaoImpl _tagsDao = ComponentLocator.inject(ResourceTagsDaoImpl.class);
|
||||
@Inject protected FirewallRulesCidrsDaoImpl _firewallRulesCidrsDao;
|
||||
@Inject ResourceTagsDaoImpl _tagsDao;
|
||||
|
||||
protected FirewallRulesDaoImpl() {
|
||||
super();
|
||||
|
||||
@ -22,6 +22,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -57,9 +58,9 @@ public class IPAddressDaoImpl extends GenericDaoBase<IPAddressVO, Long> implemen
|
||||
protected final GenericSearchBuilder<IPAddressVO, Integer> AllocatedIpCount;
|
||||
protected final GenericSearchBuilder<IPAddressVO, Integer> AllIpCountForDashboard;
|
||||
protected final GenericSearchBuilder<IPAddressVO, Long> AllocatedIpCountForAccount;
|
||||
protected final VlanDaoImpl _vlanDao = ComponentLocator.inject(VlanDaoImpl.class);
|
||||
@Inject protected VlanDaoImpl _vlanDao;
|
||||
protected GenericSearchBuilder<IPAddressVO, Long> CountFreePublicIps;
|
||||
ResourceTagsDaoImpl _tagsDao = ComponentLocator.inject(ResourceTagsDaoImpl.class);
|
||||
@Inject ResourceTagsDaoImpl _tagsDao;
|
||||
|
||||
|
||||
// make it public for JUnit test
|
||||
|
||||
@ -22,6 +22,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -52,7 +53,7 @@ public class LoadBalancerDaoImpl extends GenericDaoBase<LoadBalancerVO, Long> im
|
||||
private final SearchBuilder<LoadBalancerVO> AccountAndNameSearch;
|
||||
protected final SearchBuilder<LoadBalancerVO> TransitionStateSearch;
|
||||
|
||||
protected final FirewallRulesCidrsDaoImpl _portForwardingRulesCidrsDao = ComponentLocator.inject(FirewallRulesCidrsDaoImpl.class);
|
||||
@Inject protected FirewallRulesCidrsDaoImpl _portForwardingRulesCidrsDao;
|
||||
|
||||
protected LoadBalancerDaoImpl() {
|
||||
ListByIp = createSearchBuilder();
|
||||
|
||||
@ -21,6 +21,7 @@ import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.persistence.TableGenerator;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -77,12 +78,12 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
|
||||
final GenericSearchBuilder<NetworkVO, Long> VpcNetworksCount;
|
||||
|
||||
|
||||
ResourceTagsDaoImpl _tagsDao = ComponentLocator.inject(ResourceTagsDaoImpl.class);
|
||||
NetworkAccountDaoImpl _accountsDao = ComponentLocator.inject(NetworkAccountDaoImpl.class);
|
||||
NetworkDomainDaoImpl _domainsDao = ComponentLocator.inject(NetworkDomainDaoImpl.class);
|
||||
NetworkOpDaoImpl _opDao = ComponentLocator.inject(NetworkOpDaoImpl.class);
|
||||
NetworkServiceMapDaoImpl _ntwkSvcMap = ComponentLocator.inject(NetworkServiceMapDaoImpl.class);
|
||||
NetworkOfferingDaoImpl _ntwkOffDao = ComponentLocator.inject(NetworkOfferingDaoImpl.class);
|
||||
@Inject ResourceTagsDaoImpl _tagsDao;
|
||||
@Inject NetworkAccountDaoImpl _accountsDao;
|
||||
@Inject NetworkDomainDaoImpl _domainsDao;
|
||||
@Inject NetworkOpDaoImpl _opDao;
|
||||
@Inject NetworkServiceMapDaoImpl _ntwkSvcMap;
|
||||
@Inject NetworkOfferingDaoImpl _ntwkOffDao;
|
||||
|
||||
|
||||
final TableGenerator _tgMacAddress;
|
||||
|
||||
@ -19,6 +19,7 @@ package com.cloud.network.dao;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -39,7 +40,7 @@ import com.cloud.utils.db.SearchCriteria.Op;
|
||||
public class PhysicalNetworkDaoImpl extends GenericDaoBase<PhysicalNetworkVO, Long> implements PhysicalNetworkDao {
|
||||
final SearchBuilder<PhysicalNetworkVO> ZoneSearch;
|
||||
|
||||
protected final PhysicalNetworkTrafficTypeDaoImpl _trafficTypeDao = ComponentLocator.inject(PhysicalNetworkTrafficTypeDaoImpl.class);
|
||||
@Inject protected PhysicalNetworkTrafficTypeDaoImpl _trafficTypeDao;
|
||||
|
||||
protected PhysicalNetworkDaoImpl() {
|
||||
super();
|
||||
|
||||
@ -19,6 +19,7 @@ package com.cloud.network.dao;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -37,8 +38,8 @@ import com.cloud.utils.db.SearchCriteria;
|
||||
public class Site2SiteVpnConnectionDaoImpl extends GenericDaoBase<Site2SiteVpnConnectionVO, Long> implements Site2SiteVpnConnectionDao {
|
||||
private static final Logger s_logger = Logger.getLogger(Site2SiteVpnConnectionDaoImpl.class);
|
||||
|
||||
protected final IPAddressDaoImpl _addrDao = ComponentLocator.inject(IPAddressDaoImpl.class);
|
||||
protected final Site2SiteVpnGatewayDaoImpl _vpnGatewayDao = ComponentLocator.inject(Site2SiteVpnGatewayDaoImpl.class);
|
||||
@Inject protected IPAddressDaoImpl _addrDao;
|
||||
@Inject protected Site2SiteVpnGatewayDaoImpl _vpnGatewayDao;
|
||||
|
||||
private final SearchBuilder<Site2SiteVpnConnectionVO> AllFieldsSearch;
|
||||
private final SearchBuilder<Site2SiteVpnConnectionVO> VpcSearch;
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
package com.cloud.network.dao;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -30,7 +31,7 @@ import com.cloud.utils.db.SearchCriteria;
|
||||
@Component
|
||||
@Local(value={Site2SiteVpnGatewayDao.class})
|
||||
public class Site2SiteVpnGatewayDaoImpl extends GenericDaoBase<Site2SiteVpnGatewayVO, Long> implements Site2SiteVpnGatewayDao {
|
||||
protected final IPAddressDaoImpl _addrDao = ComponentLocator.inject(IPAddressDaoImpl.class);
|
||||
@Inject protected IPAddressDaoImpl _addrDao;
|
||||
|
||||
private static final Logger s_logger = Logger.getLogger(Site2SiteVpnGatewayDaoImpl.class);
|
||||
|
||||
|
||||
@ -20,6 +20,7 @@ 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;
|
||||
@ -45,7 +46,7 @@ import com.cloud.utils.net.NetUtils;
|
||||
@Inheritance(strategy=InheritanceType.JOINED)
|
||||
@DiscriminatorColumn(name="purpose", discriminatorType=DiscriminatorType.STRING, length=32)
|
||||
public class FirewallRuleVO implements Identity, FirewallRule {
|
||||
protected final FirewallRulesCidrsDaoImpl _firewallRulesCidrsDao = ComponentLocator.inject(FirewallRulesCidrsDaoImpl.class);
|
||||
@Inject protected final FirewallRulesCidrsDaoImpl _firewallRulesCidrsDao;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
|
||||
@ -19,6 +19,7 @@ package com.cloud.network.rules.dao;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -42,7 +43,7 @@ public class PortForwardingRulesDaoImpl extends GenericDaoBase<PortForwardingRul
|
||||
protected final SearchBuilder<PortForwardingRuleVO> AllRulesSearchByVM;
|
||||
protected final SearchBuilder<PortForwardingRuleVO> ActiveRulesSearchByAccount;
|
||||
|
||||
protected final FirewallRulesCidrsDaoImpl _portForwardingRulesCidrsDao = ComponentLocator.inject(FirewallRulesCidrsDaoImpl.class);
|
||||
@Inject protected FirewallRulesCidrsDaoImpl _portForwardingRulesCidrsDao;
|
||||
|
||||
protected PortForwardingRulesDaoImpl() {
|
||||
super();
|
||||
|
||||
@ -19,6 +19,7 @@ package com.cloud.network.security.dao;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -38,7 +39,7 @@ public class SecurityGroupDaoImpl extends GenericDaoBase<SecurityGroupVO, Long>
|
||||
private SearchBuilder<SecurityGroupVO> AccountIdSearch;
|
||||
private SearchBuilder<SecurityGroupVO> AccountIdNameSearch;
|
||||
private SearchBuilder<SecurityGroupVO> AccountIdNamesSearch;
|
||||
ResourceTagsDaoImpl _tagsDao = ComponentLocator.inject(ResourceTagsDaoImpl.class);
|
||||
@Inject ResourceTagsDaoImpl _tagsDao;
|
||||
|
||||
|
||||
protected SecurityGroupDaoImpl() {
|
||||
|
||||
@ -19,6 +19,7 @@ package com.cloud.network.vpc.dao;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -43,7 +44,7 @@ public class StaticRouteDaoImpl extends GenericDaoBase<StaticRouteVO, Long> impl
|
||||
protected final SearchBuilder<StaticRouteVO> AllFieldsSearch;
|
||||
protected final SearchBuilder<StaticRouteVO> NotRevokedSearch;
|
||||
protected final GenericSearchBuilder<StaticRouteVO, Long> RoutesByGatewayCount;
|
||||
ResourceTagsDaoImpl _tagsDao = ComponentLocator.inject(ResourceTagsDaoImpl.class);
|
||||
@Inject ResourceTagsDaoImpl _tagsDao;
|
||||
|
||||
protected StaticRouteDaoImpl() {
|
||||
super();
|
||||
|
||||
@ -19,6 +19,7 @@ package com.cloud.network.vpc.dao;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -43,7 +44,7 @@ public class VpcDaoImpl extends GenericDaoBase<VpcVO, Long> implements VpcDao{
|
||||
final GenericSearchBuilder<VpcVO, Integer> CountByOfferingId;
|
||||
final SearchBuilder<VpcVO> AllFieldsSearch;
|
||||
final GenericSearchBuilder<VpcVO, Long> CountByAccountId;
|
||||
ResourceTagsDaoImpl _tagsDao = ComponentLocator.inject(ResourceTagsDaoImpl.class);
|
||||
@Inject ResourceTagsDaoImpl _tagsDao;
|
||||
|
||||
protected VpcDaoImpl() {
|
||||
super();
|
||||
|
||||
@ -19,6 +19,7 @@ package com.cloud.projects.dao;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -43,7 +44,8 @@ public class ProjectDaoImpl extends GenericDaoBase<ProjectVO, Long> implements P
|
||||
protected final SearchBuilder<ProjectVO> AllFieldsSearch;
|
||||
protected GenericSearchBuilder<ProjectVO, Long> CountByDomain;
|
||||
protected GenericSearchBuilder<ProjectVO, Long> ProjectAccountSearch;
|
||||
ResourceTagsDaoImpl _tagsDao = ComponentLocator.inject(ResourceTagsDaoImpl.class);
|
||||
// ResourceTagsDaoImpl _tagsDao = ComponentLocator.inject(ResourceTagsDaoImpl.class);
|
||||
@Inject ResourceTagsDaoImpl _tagsDao;
|
||||
|
||||
protected ProjectDaoImpl() {
|
||||
AllFieldsSearch = createSearchBuilder();
|
||||
|
||||
@ -21,6 +21,7 @@ import java.sql.ResultSet;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -64,10 +65,10 @@ public class SnapshotDaoImpl extends GenericDaoBase<SnapshotVO, Long> implements
|
||||
private final SearchBuilder<SnapshotVO> InstanceIdSearch;
|
||||
private final SearchBuilder<SnapshotVO> StatusSearch;
|
||||
private final GenericSearchBuilder<SnapshotVO, Long> CountSnapshotsByAccount;
|
||||
ResourceTagsDaoImpl _tagsDao = ComponentLocator.inject(ResourceTagsDaoImpl.class);
|
||||
@Inject ResourceTagsDaoImpl _tagsDao;
|
||||
|
||||
protected final VMInstanceDaoImpl _instanceDao = ComponentLocator.inject(VMInstanceDaoImpl.class);
|
||||
protected final VolumeDaoImpl _volumeDao = ComponentLocator.inject(VolumeDaoImpl.class);
|
||||
@Inject protected VMInstanceDaoImpl _instanceDao;
|
||||
@Inject protected VolumeDaoImpl _volumeDao;
|
||||
|
||||
@Override
|
||||
public SnapshotVO findNextSnapshot(long snapshotId) {
|
||||
|
||||
@ -25,6 +25,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -56,7 +57,7 @@ public class StoragePoolDaoImpl extends GenericDaoBase<StoragePoolVO, Long> imp
|
||||
|
||||
|
||||
|
||||
protected final StoragePoolDetailsDao _detailsDao;
|
||||
@Inject protected StoragePoolDetailsDao _detailsDao;
|
||||
|
||||
private final String DetailsSqlPrefix = "SELECT storage_pool.* from storage_pool LEFT JOIN storage_pool_details ON storage_pool.id = storage_pool_details.pool_id WHERE storage_pool.removed is null and storage_pool.data_center_id = ? and (storage_pool.pod_id = ? or storage_pool.pod_id is null) and (";
|
||||
private final String DetailsSqlSuffix = ") GROUP BY storage_pool_details.pool_id HAVING COUNT(storage_pool_details.name) >= ?";
|
||||
@ -105,7 +106,6 @@ public class StoragePoolDaoImpl extends GenericDaoBase<StoragePoolVO, Long> imp
|
||||
StatusCountSearch.select(null, Func.COUNT, null);
|
||||
StatusCountSearch.done();
|
||||
|
||||
_detailsDao = ComponentLocator.inject(StoragePoolDetailsDaoImpl.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -109,7 +109,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
|
||||
private SearchBuilder<VMTemplateVO> UserIsoSearch;
|
||||
private GenericSearchBuilder<VMTemplateVO, Long> CountTemplatesByAccount;
|
||||
|
||||
ResourceTagsDaoImpl _tagsDao = ComponentLocator.inject(ResourceTagsDaoImpl.class);
|
||||
@Inject ResourceTagsDaoImpl _tagsDao;
|
||||
|
||||
|
||||
private String routerTmpltName;
|
||||
|
||||
@ -24,6 +24,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -50,6 +51,7 @@ import com.cloud.utils.db.Transaction;
|
||||
import com.cloud.utils.db.UpdateBuilder;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
@Component
|
||||
@Local(value=VolumeDao.class)
|
||||
public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements VolumeDao {
|
||||
private static final Logger s_logger = Logger.getLogger(VolumeDaoImpl.class);
|
||||
@ -60,7 +62,8 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
||||
protected final SearchBuilder<VolumeVO> InstanceStatesSearch;
|
||||
protected final SearchBuilder<VolumeVO> AllFieldsSearch;
|
||||
protected GenericSearchBuilder<VolumeVO, Long> CountByAccount;
|
||||
ResourceTagsDaoImpl _tagsDao = ComponentLocator.inject(ResourceTagsDaoImpl.class);
|
||||
// ResourceTagsDaoImpl _tagsDao = ComponentLocator.inject(ResourceTagsDaoImpl.class);
|
||||
@Inject ResourceTagsDaoImpl _tagsDao;
|
||||
|
||||
protected static final String SELECT_VM_SQL = "SELECT DISTINCT instance_id from volumes v where v.host_id = ? and v.mirror_state = ?";
|
||||
protected static final String SELECT_HYPERTYPE_FROM_VOLUME = "SELECT c.hypervisor_type from volumes v, storage_pool s, cluster c where v.pool_id = s.id and s.cluster_id = c.id and v.id = ?";
|
||||
|
||||
@ -22,6 +22,7 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -40,10 +41,9 @@ import com.cloud.utils.exception.CloudRuntimeException;
|
||||
public class DatabaseIntegrityChecker implements SystemIntegrityChecker {
|
||||
private final Logger s_logger = Logger.getLogger(DatabaseIntegrityChecker.class);
|
||||
|
||||
VersionDao _dao;
|
||||
@Inject VersionDao _dao;
|
||||
|
||||
public DatabaseIntegrityChecker() {
|
||||
_dao = ComponentLocator.inject(VersionDaoImpl.class);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -31,6 +31,7 @@ import java.util.List;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
@ -75,10 +76,9 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker {
|
||||
|
||||
protected HashMap<String, DbUpgrade[]> _upgradeMap = new HashMap<String, DbUpgrade[]>();
|
||||
|
||||
VersionDao _dao;
|
||||
@Inject VersionDao _dao;
|
||||
|
||||
public DatabaseUpgradeChecker() {
|
||||
_dao = ComponentLocator.inject(VersionDaoImpl.class);
|
||||
_upgradeMap.put("2.1.7", new DbUpgrade[] { new Upgrade217to218(), new Upgrade218to22(), new Upgrade221to222(),
|
||||
new UpgradeSnapshot217to224(), new Upgrade222to224(), new Upgrade224to225(), new Upgrade225to226(),
|
||||
new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(),
|
||||
|
||||
@ -18,6 +18,7 @@ package com.cloud.upgrade;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.upgrade.dao.DbUpgrade;
|
||||
@ -46,10 +47,10 @@ import com.cloud.utils.component.ComponentLocator;
|
||||
import com.cloud.utils.component.SystemIntegrityChecker;
|
||||
|
||||
@Component
|
||||
@Primary
|
||||
@Local(value = { SystemIntegrityChecker.class })
|
||||
public class PremiumDatabaseUpgradeChecker extends DatabaseUpgradeChecker {
|
||||
public PremiumDatabaseUpgradeChecker() {
|
||||
_dao = ComponentLocator.inject(VersionDaoImpl.class);
|
||||
_upgradeMap.put("2.1.7", new DbUpgrade[] { new Upgrade217to218(), new Upgrade218to22Premium(),
|
||||
new Upgrade221to222Premium(), new UpgradeSnapshot217to224(), new Upgrade222to224Premium(),
|
||||
new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228Premium(), new Upgrade228to229(),
|
||||
|
||||
@ -19,6 +19,7 @@ package com.cloud.vm.dao;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -54,10 +55,10 @@ public class DomainRouterDaoImpl extends GenericDaoBase<DomainRouterVO, Long> im
|
||||
protected final SearchBuilder<DomainRouterVO> HostUpSearch;
|
||||
protected final SearchBuilder<DomainRouterVO> StateNetworkTypeSearch;
|
||||
protected final SearchBuilder<DomainRouterVO> OutsidePodSearch;
|
||||
HostDaoImpl _hostsDao = ComponentLocator.inject(HostDaoImpl.class);
|
||||
RouterNetworkDaoImpl _routerNetworkDao = ComponentLocator.inject(RouterNetworkDaoImpl.class);
|
||||
UserStatisticsDaoImpl _userStatsDao = ComponentLocator.inject(UserStatisticsDaoImpl.class);
|
||||
NetworkOfferingDaoImpl _offDao = ComponentLocator.inject(NetworkOfferingDaoImpl.class);
|
||||
@Inject HostDaoImpl _hostsDao;
|
||||
@Inject RouterNetworkDaoImpl _routerNetworkDao;
|
||||
@Inject UserStatisticsDaoImpl _userStatsDao;
|
||||
@Inject NetworkOfferingDaoImpl _offDao;
|
||||
protected final SearchBuilder<DomainRouterVO> VpcSearch;
|
||||
|
||||
protected DomainRouterDaoImpl() {
|
||||
|
||||
@ -20,9 +20,11 @@ package com.cloud.vm.dao;
|
||||
import javax.ejb.Local;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Primary
|
||||
@Local(value = { UserVmDao.class })
|
||||
public class RandomlyIncreasingVMInstanceDaoImpl extends UserVmDaoImpl {
|
||||
|
||||
|
||||
@ -26,7 +26,9 @@ import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -58,26 +60,26 @@ import com.cloud.vm.dao.UserVmData.SecurityGroupData;
|
||||
public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements UserVmDao {
|
||||
public static final Logger s_logger = Logger.getLogger(UserVmDaoImpl.class);
|
||||
|
||||
protected final SearchBuilder<UserVmVO> AccountPodSearch;
|
||||
protected final SearchBuilder<UserVmVO> AccountDataCenterSearch;
|
||||
protected final SearchBuilder<UserVmVO> AccountSearch;
|
||||
protected final SearchBuilder<UserVmVO> HostSearch;
|
||||
protected final SearchBuilder<UserVmVO> LastHostSearch;
|
||||
protected final SearchBuilder<UserVmVO> HostUpSearch;
|
||||
protected final SearchBuilder<UserVmVO> HostRunningSearch;
|
||||
protected final SearchBuilder<UserVmVO> StateChangeSearch;
|
||||
protected final SearchBuilder<UserVmVO> AccountHostSearch;
|
||||
protected SearchBuilder<UserVmVO> AccountPodSearch;
|
||||
protected SearchBuilder<UserVmVO> AccountDataCenterSearch;
|
||||
protected SearchBuilder<UserVmVO> AccountSearch;
|
||||
protected SearchBuilder<UserVmVO> HostSearch;
|
||||
protected SearchBuilder<UserVmVO> LastHostSearch;
|
||||
protected SearchBuilder<UserVmVO> HostUpSearch;
|
||||
protected SearchBuilder<UserVmVO> HostRunningSearch;
|
||||
protected SearchBuilder<UserVmVO> StateChangeSearch;
|
||||
protected SearchBuilder<UserVmVO> AccountHostSearch;
|
||||
|
||||
protected final SearchBuilder<UserVmVO> DestroySearch;
|
||||
protected SearchBuilder<UserVmVO> DestroySearch;
|
||||
protected SearchBuilder<UserVmVO> AccountDataCenterVirtualSearch;
|
||||
protected GenericSearchBuilder<UserVmVO, Long> CountByAccountPod;
|
||||
protected GenericSearchBuilder<UserVmVO, Long> CountByAccount;
|
||||
protected GenericSearchBuilder<UserVmVO, Long> PodsHavingVmsForAccount;
|
||||
|
||||
protected SearchBuilder<UserVmVO> UserVmSearch;
|
||||
protected final Attribute _updateTimeAttr;
|
||||
ResourceTagsDaoImpl _tagsDao = ComponentLocator.inject(ResourceTagsDaoImpl.class);
|
||||
|
||||
protected Attribute _updateTimeAttr;
|
||||
// ResourceTagsDaoImpl _tagsDao = ComponentLocator.inject(ResourceTagsDaoImpl.class);
|
||||
@Inject ResourceTagsDaoImpl _tagsDao;
|
||||
|
||||
private static final String LIST_PODS_HAVING_VMS_FOR_ACCOUNT = "SELECT pod_id FROM cloud.vm_instance WHERE data_center_id = ? AND account_id = ? AND pod_id IS NOT NULL AND (state = 'Running' OR state = 'Stopped') " +
|
||||
"GROUP BY pod_id HAVING count(id) > 0 ORDER BY count(id) DESC";
|
||||
@ -112,87 +114,91 @@ public class UserVmDaoImpl extends GenericDaoBase<UserVmVO, Long> implements Use
|
||||
|
||||
private static final int VM_DETAILS_BATCH_SIZE=100;
|
||||
|
||||
protected final UserVmDetailsDaoImpl _detailsDao = ComponentLocator.inject(UserVmDetailsDaoImpl.class);
|
||||
protected final NicDaoImpl _nicDao = ComponentLocator.inject(NicDaoImpl.class);
|
||||
@Inject protected UserVmDetailsDao _detailsDao;
|
||||
@Inject protected NicDao _nicDao;
|
||||
|
||||
protected UserVmDaoImpl() {
|
||||
AccountSearch = createSearchBuilder();
|
||||
AccountSearch.and("account", AccountSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
|
||||
AccountSearch.done();
|
||||
|
||||
HostSearch = createSearchBuilder();
|
||||
HostSearch.and("host", HostSearch.entity().getHostId(), SearchCriteria.Op.EQ);
|
||||
HostSearch.done();
|
||||
|
||||
LastHostSearch = createSearchBuilder();
|
||||
LastHostSearch.and("lastHost", LastHostSearch.entity().getLastHostId(), SearchCriteria.Op.EQ);
|
||||
LastHostSearch.and("state", LastHostSearch.entity().getState(), SearchCriteria.Op.EQ);
|
||||
LastHostSearch.done();
|
||||
|
||||
HostUpSearch = createSearchBuilder();
|
||||
HostUpSearch.and("host", HostUpSearch.entity().getHostId(), SearchCriteria.Op.EQ);
|
||||
HostUpSearch.and("states", HostUpSearch.entity().getState(), SearchCriteria.Op.NIN);
|
||||
HostUpSearch.done();
|
||||
|
||||
HostRunningSearch = createSearchBuilder();
|
||||
HostRunningSearch.and("host", HostRunningSearch.entity().getHostId(), SearchCriteria.Op.EQ);
|
||||
HostRunningSearch.and("state", HostRunningSearch.entity().getState(), SearchCriteria.Op.EQ);
|
||||
HostRunningSearch.done();
|
||||
|
||||
AccountPodSearch = createSearchBuilder();
|
||||
AccountPodSearch.and("account", AccountPodSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
|
||||
AccountPodSearch.and("pod", AccountPodSearch.entity().getPodIdToDeployIn(), SearchCriteria.Op.EQ);
|
||||
AccountPodSearch.done();
|
||||
|
||||
AccountDataCenterSearch = createSearchBuilder();
|
||||
AccountDataCenterSearch.and("account", AccountDataCenterSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
|
||||
AccountDataCenterSearch.and("dc", AccountDataCenterSearch.entity().getDataCenterIdToDeployIn(), SearchCriteria.Op.EQ);
|
||||
AccountDataCenterSearch.done();
|
||||
|
||||
StateChangeSearch = createSearchBuilder();
|
||||
StateChangeSearch.and("id", StateChangeSearch.entity().getId(), SearchCriteria.Op.EQ);
|
||||
StateChangeSearch.and("states", StateChangeSearch.entity().getState(), SearchCriteria.Op.EQ);
|
||||
StateChangeSearch.and("host", StateChangeSearch.entity().getHostId(), SearchCriteria.Op.EQ);
|
||||
StateChangeSearch.and("update", StateChangeSearch.entity().getUpdated(), SearchCriteria.Op.EQ);
|
||||
StateChangeSearch.done();
|
||||
|
||||
DestroySearch = createSearchBuilder();
|
||||
DestroySearch.and("state", DestroySearch.entity().getState(), SearchCriteria.Op.IN);
|
||||
DestroySearch.and("updateTime", DestroySearch.entity().getUpdateTime(), SearchCriteria.Op.LT);
|
||||
DestroySearch.done();
|
||||
|
||||
AccountHostSearch = createSearchBuilder();
|
||||
AccountHostSearch.and("accountId", AccountHostSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
|
||||
AccountHostSearch.and("hostId", AccountHostSearch.entity().getHostId(), SearchCriteria.Op.EQ);
|
||||
AccountHostSearch.done();
|
||||
|
||||
CountByAccountPod = createSearchBuilder(Long.class);
|
||||
CountByAccountPod.select(null, Func.COUNT, null);
|
||||
CountByAccountPod.and("account", CountByAccountPod.entity().getAccountId(), SearchCriteria.Op.EQ);
|
||||
CountByAccountPod.and("pod", CountByAccountPod.entity().getPodIdToDeployIn(), SearchCriteria.Op.EQ);
|
||||
CountByAccountPod.done();
|
||||
|
||||
CountByAccount = createSearchBuilder(Long.class);
|
||||
CountByAccount.select(null, Func.COUNT, null);
|
||||
CountByAccount.and("account", CountByAccount.entity().getAccountId(), SearchCriteria.Op.EQ);
|
||||
CountByAccount.and("type", CountByAccount.entity().getType(), SearchCriteria.Op.EQ);
|
||||
CountByAccount.and("state", CountByAccount.entity().getState(), SearchCriteria.Op.NIN);
|
||||
CountByAccount.done();
|
||||
|
||||
|
||||
SearchBuilder<NicVO> nicSearch = _nicDao.createSearchBuilder();
|
||||
nicSearch.and("networkId", nicSearch.entity().getNetworkId(), SearchCriteria.Op.EQ);
|
||||
nicSearch.and("ip4Address", nicSearch.entity().getIp4Address(), SearchCriteria.Op.NNULL);
|
||||
|
||||
AccountDataCenterVirtualSearch = createSearchBuilder();
|
||||
AccountDataCenterVirtualSearch.and("account", AccountDataCenterVirtualSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
|
||||
AccountDataCenterVirtualSearch.and("dc", AccountDataCenterVirtualSearch.entity().getDataCenterIdToDeployIn(), SearchCriteria.Op.EQ);
|
||||
AccountDataCenterVirtualSearch.join("nicSearch", nicSearch, AccountDataCenterVirtualSearch.entity().getId(), nicSearch.entity().getInstanceId(), JoinBuilder.JoinType.INNER);
|
||||
AccountDataCenterVirtualSearch.done();
|
||||
|
||||
|
||||
_updateTimeAttr = _allAttributes.get("updateTime");
|
||||
assert _updateTimeAttr != null : "Couldn't get this updateTime attribute";
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
void init() {
|
||||
AccountSearch = createSearchBuilder();
|
||||
AccountSearch.and("account", AccountSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
|
||||
AccountSearch.done();
|
||||
|
||||
HostSearch = createSearchBuilder();
|
||||
HostSearch.and("host", HostSearch.entity().getHostId(), SearchCriteria.Op.EQ);
|
||||
HostSearch.done();
|
||||
|
||||
LastHostSearch = createSearchBuilder();
|
||||
LastHostSearch.and("lastHost", LastHostSearch.entity().getLastHostId(), SearchCriteria.Op.EQ);
|
||||
LastHostSearch.and("state", LastHostSearch.entity().getState(), SearchCriteria.Op.EQ);
|
||||
LastHostSearch.done();
|
||||
|
||||
HostUpSearch = createSearchBuilder();
|
||||
HostUpSearch.and("host", HostUpSearch.entity().getHostId(), SearchCriteria.Op.EQ);
|
||||
HostUpSearch.and("states", HostUpSearch.entity().getState(), SearchCriteria.Op.NIN);
|
||||
HostUpSearch.done();
|
||||
|
||||
HostRunningSearch = createSearchBuilder();
|
||||
HostRunningSearch.and("host", HostRunningSearch.entity().getHostId(), SearchCriteria.Op.EQ);
|
||||
HostRunningSearch.and("state", HostRunningSearch.entity().getState(), SearchCriteria.Op.EQ);
|
||||
HostRunningSearch.done();
|
||||
|
||||
AccountPodSearch = createSearchBuilder();
|
||||
AccountPodSearch.and("account", AccountPodSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
|
||||
AccountPodSearch.and("pod", AccountPodSearch.entity().getPodIdToDeployIn(), SearchCriteria.Op.EQ);
|
||||
AccountPodSearch.done();
|
||||
|
||||
AccountDataCenterSearch = createSearchBuilder();
|
||||
AccountDataCenterSearch.and("account", AccountDataCenterSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
|
||||
AccountDataCenterSearch.and("dc", AccountDataCenterSearch.entity().getDataCenterIdToDeployIn(), SearchCriteria.Op.EQ);
|
||||
AccountDataCenterSearch.done();
|
||||
|
||||
StateChangeSearch = createSearchBuilder();
|
||||
StateChangeSearch.and("id", StateChangeSearch.entity().getId(), SearchCriteria.Op.EQ);
|
||||
StateChangeSearch.and("states", StateChangeSearch.entity().getState(), SearchCriteria.Op.EQ);
|
||||
StateChangeSearch.and("host", StateChangeSearch.entity().getHostId(), SearchCriteria.Op.EQ);
|
||||
StateChangeSearch.and("update", StateChangeSearch.entity().getUpdated(), SearchCriteria.Op.EQ);
|
||||
StateChangeSearch.done();
|
||||
|
||||
DestroySearch = createSearchBuilder();
|
||||
DestroySearch.and("state", DestroySearch.entity().getState(), SearchCriteria.Op.IN);
|
||||
DestroySearch.and("updateTime", DestroySearch.entity().getUpdateTime(), SearchCriteria.Op.LT);
|
||||
DestroySearch.done();
|
||||
|
||||
AccountHostSearch = createSearchBuilder();
|
||||
AccountHostSearch.and("accountId", AccountHostSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
|
||||
AccountHostSearch.and("hostId", AccountHostSearch.entity().getHostId(), SearchCriteria.Op.EQ);
|
||||
AccountHostSearch.done();
|
||||
|
||||
CountByAccountPod = createSearchBuilder(Long.class);
|
||||
CountByAccountPod.select(null, Func.COUNT, null);
|
||||
CountByAccountPod.and("account", CountByAccountPod.entity().getAccountId(), SearchCriteria.Op.EQ);
|
||||
CountByAccountPod.and("pod", CountByAccountPod.entity().getPodIdToDeployIn(), SearchCriteria.Op.EQ);
|
||||
CountByAccountPod.done();
|
||||
|
||||
CountByAccount = createSearchBuilder(Long.class);
|
||||
CountByAccount.select(null, Func.COUNT, null);
|
||||
CountByAccount.and("account", CountByAccount.entity().getAccountId(), SearchCriteria.Op.EQ);
|
||||
CountByAccount.and("type", CountByAccount.entity().getType(), SearchCriteria.Op.EQ);
|
||||
CountByAccount.and("state", CountByAccount.entity().getState(), SearchCriteria.Op.NIN);
|
||||
CountByAccount.done();
|
||||
|
||||
|
||||
SearchBuilder<NicVO> nicSearch = _nicDao.createSearchBuilder();
|
||||
nicSearch.and("networkId", nicSearch.entity().getNetworkId(), SearchCriteria.Op.EQ);
|
||||
nicSearch.and("ip4Address", nicSearch.entity().getIp4Address(), SearchCriteria.Op.NNULL);
|
||||
|
||||
AccountDataCenterVirtualSearch = createSearchBuilder();
|
||||
AccountDataCenterVirtualSearch.and("account", AccountDataCenterVirtualSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
|
||||
AccountDataCenterVirtualSearch.and("dc", AccountDataCenterVirtualSearch.entity().getDataCenterIdToDeployIn(), SearchCriteria.Op.EQ);
|
||||
AccountDataCenterVirtualSearch.join("nicSearch", nicSearch, AccountDataCenterVirtualSearch.entity().getId(), nicSearch.entity().getInstanceId(), JoinBuilder.JoinType.INNER);
|
||||
AccountDataCenterVirtualSearch.done();
|
||||
|
||||
|
||||
_updateTimeAttr = _allAttributes.get("updateTime");
|
||||
assert _updateTimeAttr != null : "Couldn't get this updateTime attribute";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -84,8 +84,8 @@ public class VMInstanceDaoImpl extends GenericDaoBase<VMInstanceVO, Long> implem
|
||||
protected SearchBuilder<VMInstanceVO> NetworkTypeSearch;
|
||||
protected GenericSearchBuilder<VMInstanceVO, String> DistinctHostNameSearch;
|
||||
|
||||
ResourceTagsDaoImpl _tagsDao = ComponentLocator.inject(ResourceTagsDaoImpl.class);
|
||||
NicDao _nicDao = ComponentLocator.inject(NicDaoImpl.class);
|
||||
@Inject ResourceTagsDaoImpl _tagsDao;
|
||||
@Inject NicDao _nicDao;
|
||||
|
||||
protected final Attribute _updateTimeAttr;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user