mirror of https://github.com/apache/cloudstack.git
ResourceDetails -
1) added createDetail to ResourceDetailDao interface to provide generic way of creating resourceDetail DB objects 2) added resource details support for firewall rules
This commit is contained in:
parent
9b1cfa41eb
commit
5caeab782d
|
|
@ -33,7 +33,7 @@ public interface ResourceTag extends ControlledEntity, Identity, InternalIdentit
|
|||
Nic (false, true),
|
||||
LoadBalancer (true, false),
|
||||
PortForwardingRule (true, false),
|
||||
FirewallRule (true, false),
|
||||
FirewallRule (true, true),
|
||||
SecurityGroup (true, false),
|
||||
PublicIpAddress (true, false),
|
||||
Project (true, false),
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@
|
|||
<bean id="networkRuleConfigDaoImpl" class="com.cloud.network.dao.NetworkRuleConfigDaoImpl" />
|
||||
<bean id="networkServiceMapDaoImpl" class="com.cloud.network.dao.NetworkServiceMapDaoImpl" />
|
||||
<bean id="nicDaoImpl" class="com.cloud.vm.dao.NicDaoImpl" />
|
||||
<bean id="nicDetailDaoImpl" class="com.cloud.vm.dao.NicDetailDaoImpl" />
|
||||
<bean id="nicDetailsDaoImpl" class="com.cloud.vm.dao.NicDetailsDaoImpl" />
|
||||
<bean id="nicSecondaryIpDaoImpl" class="com.cloud.vm.dao.NicSecondaryIpDaoImpl" />
|
||||
<bean id="nicIpAliasDaoImpl" class="com.cloud.vm.dao.NicIpAliasDaoImpl" />
|
||||
<bean id="objectInDataStoreDaoImpl" class="org.apache.cloudstack.storage.db.ObjectInDataStoreDaoImpl" />
|
||||
|
|
@ -313,10 +313,10 @@
|
|||
<bean id="networkOfferingDetailsDaoImpl" class="com.cloud.offerings.dao.NetworkOfferingDetailsDaoImpl" />
|
||||
<bean id="serviceOfferingDetailsDaoImpl" class="com.cloud.service.dao.ServiceOfferingDetailsDaoImpl"/>
|
||||
<bean id="networkDetailsDaoImpl" class="com.cloud.network.dao.NetworkDetailsDaoImpl" />
|
||||
|
||||
<bean id="AffinityGroupDaoImpl" class="org.apache.cloudstack.affinity.dao.AffinityGroupDaoImpl" />
|
||||
<bean id="AffinityGroupVMMapDaoImpl" class="org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDaoImpl" />
|
||||
<bean id="AffinityGroupDomainMapDaoImpl" class="org.apache.cloudstack.affinity.dao.AffinityGroupDomainMapDaoImpl" />
|
||||
<bean id="FirewallRuleDetailsDaoImpl" class="org.apache.cloudstack.resourcedetail.dao.FirewallRuleDetailsDaoImpl" />
|
||||
|
||||
<bean id="databaseIntegrityChecker" class="com.cloud.upgrade.DatabaseIntegrityChecker" />
|
||||
|
||||
|
|
|
|||
|
|
@ -19,5 +19,5 @@ package com.cloud.dc.dao;
|
|||
import com.cloud.dc.DataCenterDetailVO;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
public interface DataCenterDetailsDao extends GenericDao<DataCenterDetailVO, Long>, ResourceDetailDao<DataCenterDetailVO> {
|
||||
public interface DataCenterDetailsDao extends GenericDao<DataCenterDetailVO, Long>, ResourceDetailsDao<DataCenterDetailVO> {
|
||||
}
|
||||
|
|
@ -26,7 +26,8 @@ import org.apache.cloudstack.framework.config.ScopedConfigStorage;
|
|||
import com.cloud.dc.DataCenterDetailVO;
|
||||
|
||||
@Local(value=DataCenterDetailsDao.class)
|
||||
public class DataCenterDetailsDaoImpl extends ResourceDetailDaoBase<DataCenterDetailVO> implements DataCenterDetailsDao, ScopedConfigStorage {
|
||||
public class DataCenterDetailsDaoImpl extends ResourceDetailsDaoBase<DataCenterDetailVO> implements DataCenterDetailsDao, ScopedConfigStorage {
|
||||
|
||||
|
||||
@Override
|
||||
public Scope getScope() {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import org.apache.cloudstack.api.ResourceDetail;
|
|||
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
public interface ResourceDetailDao<R extends ResourceDetail> extends GenericDao<R, Long>{
|
||||
public interface ResourceDetailsDao<R extends ResourceDetail> extends GenericDao<R, Long>{
|
||||
public R findDetail(long resourceId, String name);
|
||||
|
||||
public Map<String, String> findDetails(long resourceId);
|
||||
|
|
@ -28,10 +28,10 @@ import com.cloud.utils.db.SearchCriteria;
|
|||
import com.cloud.utils.db.TransactionLegacy;
|
||||
|
||||
|
||||
public abstract class ResourceDetailDaoBase<R extends ResourceDetail> extends GenericDaoBase<R, Long>{
|
||||
public abstract class ResourceDetailsDaoBase<R extends ResourceDetail> extends GenericDaoBase<R, Long>{
|
||||
private SearchBuilder<R> AllFieldsSearch;
|
||||
|
||||
public ResourceDetailDaoBase() {
|
||||
public ResourceDetailsDaoBase() {
|
||||
AllFieldsSearch = createSearchBuilder();
|
||||
AllFieldsSearch.and("resourceId", AllFieldsSearch.entity().getResourceId(), SearchCriteria.Op.EQ);
|
||||
AllFieldsSearch.and("name", AllFieldsSearch.entity().getName(), SearchCriteria.Op.EQ);
|
||||
|
|
@ -16,9 +16,9 @@
|
|||
// under the License.
|
||||
package com.cloud.network.dao;
|
||||
|
||||
import com.cloud.dc.dao.ResourceDetailDao;
|
||||
import com.cloud.dc.dao.ResourceDetailsDao;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
public interface NetworkDetailsDao extends GenericDao<NetworkDetailVO, Long>, ResourceDetailDao<NetworkDetailVO> {
|
||||
public interface NetworkDetailsDao extends GenericDao<NetworkDetailVO, Long>, ResourceDetailsDao<NetworkDetailVO> {
|
||||
|
||||
}
|
||||
|
|
@ -20,11 +20,11 @@ import javax.ejb.Local;
|
|||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.dc.dao.ResourceDetailDaoBase;
|
||||
import com.cloud.dc.dao.ResourceDetailsDaoBase;
|
||||
|
||||
@Component
|
||||
@Local(value=NetworkDetailsDao.class)
|
||||
public class NetworkDetailsDaoImpl extends ResourceDetailDaoBase<NetworkDetailVO> implements NetworkDetailsDao {
|
||||
public class NetworkDetailsDaoImpl extends ResourceDetailsDaoBase<NetworkDetailVO> implements NetworkDetailsDao {
|
||||
|
||||
@Override
|
||||
public NetworkDetailVO createDetail(long resourceId, String key, String value) {
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@
|
|||
// under the License.
|
||||
package com.cloud.service.dao;
|
||||
|
||||
import com.cloud.dc.dao.ResourceDetailDao;
|
||||
import com.cloud.dc.dao.ResourceDetailsDao;
|
||||
import com.cloud.service.ServiceOfferingDetailsVO;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
public interface ServiceOfferingDetailsDao extends GenericDao<ServiceOfferingDetailsVO, Long>, ResourceDetailDao<ServiceOfferingDetailsVO> {
|
||||
public interface ServiceOfferingDetailsDao extends GenericDao<ServiceOfferingDetailsVO, Long>, ResourceDetailsDao<ServiceOfferingDetailsVO> {
|
||||
}
|
||||
|
|
@ -20,12 +20,12 @@ import javax.ejb.Local;
|
|||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.dc.dao.ResourceDetailDaoBase;
|
||||
import com.cloud.dc.dao.ResourceDetailsDaoBase;
|
||||
import com.cloud.service.ServiceOfferingDetailsVO;
|
||||
|
||||
@Component
|
||||
@Local(value=ServiceOfferingDetailsDao.class)
|
||||
public class ServiceOfferingDetailsDaoImpl extends ResourceDetailDaoBase<ServiceOfferingDetailsVO>
|
||||
public class ServiceOfferingDetailsDaoImpl extends ResourceDetailsDaoBase<ServiceOfferingDetailsVO>
|
||||
implements ServiceOfferingDetailsDao {
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ import org.apache.cloudstack.framework.config.ScopedConfigStorage;
|
|||
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailVO;
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;
|
||||
|
||||
import com.cloud.dc.dao.ResourceDetailDaoBase;
|
||||
import com.cloud.dc.dao.ResourceDetailsDaoBase;
|
||||
|
||||
@Local(value = StoragePoolDetailsDao.class)
|
||||
public class StoragePoolDetailsDaoImpl extends ResourceDetailDaoBase<StoragePoolDetailVO> implements StoragePoolDetailsDao, ScopedConfigStorage {
|
||||
public class StoragePoolDetailsDaoImpl extends ResourceDetailsDaoBase<StoragePoolDetailVO> implements StoragePoolDetailsDao, ScopedConfigStorage {
|
||||
|
||||
public StoragePoolDetailsDaoImpl() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@
|
|||
// under the License.
|
||||
package com.cloud.storage.dao;
|
||||
|
||||
import com.cloud.dc.dao.ResourceDetailDao;
|
||||
import com.cloud.dc.dao.ResourceDetailsDao;
|
||||
import com.cloud.storage.VMTemplateDetailVO;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
public interface VMTemplateDetailsDao extends GenericDao<VMTemplateDetailVO, Long>, ResourceDetailDao<VMTemplateDetailVO> {
|
||||
public interface VMTemplateDetailsDao extends GenericDao<VMTemplateDetailVO, Long>, ResourceDetailsDao<VMTemplateDetailVO> {
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,12 +20,12 @@ import javax.ejb.Local;
|
|||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.dc.dao.ResourceDetailDaoBase;
|
||||
import com.cloud.dc.dao.ResourceDetailsDaoBase;
|
||||
import com.cloud.storage.VMTemplateDetailVO;
|
||||
|
||||
@Component
|
||||
@Local(value = VMTemplateDetailsDao.class)
|
||||
public class VMTemplateDetailsDaoImpl extends ResourceDetailDaoBase<VMTemplateDetailVO> implements VMTemplateDetailsDao {
|
||||
public class VMTemplateDetailsDaoImpl extends ResourceDetailsDaoBase<VMTemplateDetailVO> implements VMTemplateDetailsDao {
|
||||
|
||||
@Override
|
||||
public VMTemplateDetailVO createDetail(long resourceId, String key, String value) {
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@
|
|||
// under the License.
|
||||
package com.cloud.storage.dao;
|
||||
|
||||
import com.cloud.dc.dao.ResourceDetailDao;
|
||||
import com.cloud.dc.dao.ResourceDetailsDao;
|
||||
import com.cloud.storage.VolumeDetailVO;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
public interface VolumeDetailsDao extends GenericDao<VolumeDetailVO, Long>, ResourceDetailDao<VolumeDetailVO> {
|
||||
public interface VolumeDetailsDao extends GenericDao<VolumeDetailVO, Long>, ResourceDetailsDao<VolumeDetailVO> {
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,12 +20,12 @@ import javax.ejb.Local;
|
|||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.dc.dao.ResourceDetailDaoBase;
|
||||
import com.cloud.dc.dao.ResourceDetailsDaoBase;
|
||||
import com.cloud.storage.VolumeDetailVO;
|
||||
|
||||
@Component
|
||||
@Local(value=VolumeDetailsDao.class)
|
||||
public class VolumeDetailsDaoImpl extends ResourceDetailDaoBase<VolumeDetailVO> implements VolumeDetailsDao {
|
||||
public class VolumeDetailsDaoImpl extends ResourceDetailsDaoBase<VolumeDetailVO> implements VolumeDetailsDao {
|
||||
|
||||
@Override
|
||||
public VolumeDetailVO createDetail(long resourceId, String key, String value) {
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@
|
|||
// under the License.
|
||||
package com.cloud.vm.dao;
|
||||
|
||||
import com.cloud.dc.dao.ResourceDetailDao;
|
||||
import com.cloud.dc.dao.ResourceDetailsDao;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
import com.cloud.vm.NicDetailVO;
|
||||
|
||||
public interface NicDetailDao extends GenericDao<NicDetailVO, Long>, ResourceDetailDao<NicDetailVO> {
|
||||
public interface NicDetailsDao extends GenericDao<NicDetailVO, Long>, ResourceDetailsDao<NicDetailVO> {
|
||||
}
|
||||
|
|
@ -20,12 +20,12 @@ import javax.ejb.Local;
|
|||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.dc.dao.ResourceDetailDaoBase;
|
||||
import com.cloud.dc.dao.ResourceDetailsDaoBase;
|
||||
import com.cloud.vm.NicDetailVO;
|
||||
|
||||
@Component
|
||||
@Local (value={NicDetailDao.class})
|
||||
public class NicDetailDaoImpl extends ResourceDetailDaoBase<NicDetailVO> implements NicDetailDao {
|
||||
@Local (value={NicDetailsDao.class})
|
||||
public class NicDetailsDaoImpl extends ResourceDetailsDaoBase<NicDetailVO> implements NicDetailsDao {
|
||||
|
||||
@Override
|
||||
public NicDetailVO createDetail(long resourceId, String key, String value) {
|
||||
|
|
@ -16,9 +16,9 @@
|
|||
// under the License.
|
||||
package com.cloud.vm.dao;
|
||||
|
||||
import com.cloud.dc.dao.ResourceDetailDao;
|
||||
import com.cloud.dc.dao.ResourceDetailsDao;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
import com.cloud.vm.UserVmDetailVO;
|
||||
|
||||
public interface UserVmDetailsDao extends GenericDao<UserVmDetailVO, Long>, ResourceDetailDao<UserVmDetailVO> {
|
||||
public interface UserVmDetailsDao extends GenericDao<UserVmDetailVO, Long>, ResourceDetailsDao<UserVmDetailVO> {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,12 +20,12 @@ import javax.ejb.Local;
|
|||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.dc.dao.ResourceDetailDaoBase;
|
||||
import com.cloud.dc.dao.ResourceDetailsDaoBase;
|
||||
import com.cloud.vm.UserVmDetailVO;
|
||||
|
||||
@Component
|
||||
@Local(value=UserVmDetailsDao.class)
|
||||
public class UserVmDetailsDaoImpl extends ResourceDetailDaoBase<UserVmDetailVO> implements UserVmDetailsDao {
|
||||
public class UserVmDetailsDaoImpl extends ResourceDetailsDaoBase<UserVmDetailVO> implements UserVmDetailsDao {
|
||||
|
||||
@Override
|
||||
public UserVmDetailVO createDetail(long resourceId, String key, String value) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,72 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.resourcedetail;
|
||||
|
||||
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 org.apache.cloudstack.api.ResourceDetail;
|
||||
|
||||
@Entity
|
||||
@Table(name="firewall_rule_details")
|
||||
public class FirewallRuleDetailVO implements ResourceDetail{
|
||||
@Id
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
@Column(name="id")
|
||||
private long id;
|
||||
|
||||
@Column(name="firewall_rule_id")
|
||||
private long resourceId;
|
||||
|
||||
@Column(name="name")
|
||||
private String name;
|
||||
|
||||
@Column(name="value", length=1024)
|
||||
private String value;
|
||||
|
||||
public FirewallRuleDetailVO() {}
|
||||
|
||||
public FirewallRuleDetailVO(long networkId, String name, String value) {
|
||||
this.resourceId = networkId;
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getResourceId() {
|
||||
return resourceId;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.resourcedetail.dao;
|
||||
|
||||
import org.apache.cloudstack.resourcedetail.FirewallRuleDetailVO;
|
||||
|
||||
import com.cloud.dc.dao.ResourceDetailsDao;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
public interface FirewallRuleDetailsDao extends GenericDao<FirewallRuleDetailVO, Long>, ResourceDetailsDao<FirewallRuleDetailVO>{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.resourcedetail.dao;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import org.apache.cloudstack.resourcedetail.FirewallRuleDetailVO;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.dc.dao.ResourceDetailsDaoBase;
|
||||
|
||||
@Component
|
||||
@Local (value={FirewallRuleDetailsDao.class})
|
||||
public class FirewallRuleDetailsDaoImpl extends ResourceDetailsDaoBase<FirewallRuleDetailVO> implements FirewallRuleDetailsDao {
|
||||
|
||||
@Override
|
||||
public FirewallRuleDetailVO createDetail(long resourceId, String key, String value) {
|
||||
return new FirewallRuleDetailVO(resourceId, key, value);
|
||||
}
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
// under the License.
|
||||
package org.apache.cloudstack.storage.datastore.db;
|
||||
|
||||
import com.cloud.dc.dao.ResourceDetailDao;
|
||||
import com.cloud.dc.dao.ResourceDetailsDao;
|
||||
|
||||
public interface PrimaryDataStoreDetailsDao extends ResourceDetailDao<PrimaryDataStoreDetailVO> {
|
||||
public interface PrimaryDataStoreDetailsDao extends ResourceDetailsDao<PrimaryDataStoreDetailVO> {
|
||||
}
|
||||
|
|
@ -16,8 +16,8 @@
|
|||
// under the License.
|
||||
package org.apache.cloudstack.storage.datastore.db;
|
||||
|
||||
import com.cloud.dc.dao.ResourceDetailDao;
|
||||
import com.cloud.dc.dao.ResourceDetailsDao;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
public interface StoragePoolDetailsDao extends GenericDao<StoragePoolDetailVO, Long>, ResourceDetailDao<StoragePoolDetailVO> {
|
||||
public interface StoragePoolDetailsDao extends GenericDao<StoragePoolDetailVO, Long>, ResourceDetailsDao<StoragePoolDetailVO> {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDetailVO;
|
|||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDetailsDao;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.dc.dao.ResourceDetailDaoBase;
|
||||
import com.cloud.dc.dao.ResourceDetailsDaoBase;
|
||||
|
||||
@Component
|
||||
public class PrimaryDataStoreDetailsDaoImpl extends ResourceDetailDaoBase<PrimaryDataStoreDetailVO> implements
|
||||
public class PrimaryDataStoreDetailsDaoImpl extends ResourceDetailsDaoBase<PrimaryDataStoreDetailVO> implements
|
||||
PrimaryDataStoreDetailsDao {
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ import com.cloud.dc.dao.ClusterDao;
|
|||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.dc.dao.DataCenterDetailsDao;
|
||||
import com.cloud.dc.dao.HostPodDao;
|
||||
import com.cloud.dc.dao.ResourceDetailDaoBase;
|
||||
import com.cloud.dc.dao.ResourceDetailsDaoBase;
|
||||
import com.cloud.dc.dao.VlanDao;
|
||||
import com.cloud.domain.DomainVO;
|
||||
import com.cloud.domain.dao.DomainDao;
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ import com.cloud.vm.DomainRouterVO;
|
|||
import com.cloud.vm.UserVmVO;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.dao.DomainRouterDao;
|
||||
import com.cloud.vm.dao.NicDetailDao;
|
||||
import com.cloud.vm.dao.NicDetailsDao;
|
||||
import com.cloud.vm.dao.UserVmDao;
|
||||
import com.cloud.vm.dao.UserVmDetailsDao;
|
||||
|
||||
|
|
@ -295,7 +295,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
|||
private VolumeDetailsDao _volumeDetailDao;
|
||||
|
||||
@Inject
|
||||
private NicDetailDao _nicDetailDao;
|
||||
private NicDetailsDao _nicDetailDao;
|
||||
|
||||
@Inject
|
||||
UserVmDetailsDao _userVmDetailDao;
|
||||
|
|
|
|||
|
|
@ -26,12 +26,13 @@ import javax.inject.Inject;
|
|||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.cloudstack.api.ResourceDetail;
|
||||
import org.apache.cloudstack.resourcedetail.dao.FirewallRuleDetailsDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.dc.dao.DataCenterDetailsDao;
|
||||
import com.cloud.dc.dao.ResourceDetailDao;
|
||||
import com.cloud.dc.dao.ResourceDetailsDao;
|
||||
import com.cloud.event.ActionEvent;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
|
|
@ -47,7 +48,7 @@ import com.cloud.utils.db.DB;
|
|||
import com.cloud.utils.db.Transaction;
|
||||
import com.cloud.utils.db.TransactionCallback;
|
||||
import com.cloud.utils.db.TransactionStatus;
|
||||
import com.cloud.vm.dao.NicDetailDao;
|
||||
import com.cloud.vm.dao.NicDetailsDao;
|
||||
import com.cloud.vm.dao.UserVmDetailsDao;
|
||||
|
||||
|
||||
|
|
@ -58,7 +59,7 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource
|
|||
@Inject
|
||||
VolumeDetailsDao _volumeDetailDao;
|
||||
@Inject
|
||||
NicDetailDao _nicDetailDao;
|
||||
NicDetailsDao _nicDetailDao;
|
||||
@Inject
|
||||
UserVmDetailsDao _userVmDetailDao;
|
||||
@Inject
|
||||
|
|
@ -73,9 +74,11 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource
|
|||
ServiceOfferingDetailsDao _serviceOfferingDetailsDao;
|
||||
@Inject
|
||||
StoragePoolDetailsDao _storageDetailsDao;
|
||||
@Inject
|
||||
FirewallRuleDetailsDao _firewallRuleDetailsDao;
|
||||
|
||||
private static Map<ResourceObjectType, ResourceDetailDao<? extends ResourceDetail>> _daoMap=
|
||||
new HashMap<ResourceObjectType, ResourceDetailDao<? extends ResourceDetail>>();
|
||||
private static Map<ResourceObjectType, ResourceDetailsDao<? extends ResourceDetail>> _daoMap=
|
||||
new HashMap<ResourceObjectType, ResourceDetailsDao<? extends ResourceDetail>>();
|
||||
|
||||
|
||||
@Override
|
||||
|
|
@ -88,6 +91,7 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource
|
|||
_daoMap.put(ResourceObjectType.ServiceOffering, _serviceOfferingDetailsDao);
|
||||
_daoMap.put(ResourceObjectType.Zone, _dcDetailsDao);
|
||||
_daoMap.put(ResourceObjectType.Storage, _storageDetailsDao);
|
||||
_daoMap.put(ResourceObjectType.FirewallRule, _firewallRuleDetailsDao);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -148,18 +152,18 @@ public class ResourceMetaDataManagerImpl extends ManagerBase implements Resource
|
|||
|
||||
private class DetailDaoHelper {
|
||||
private ResourceObjectType resourceType;
|
||||
private ResourceDetailDao<? super ResourceDetail> dao;
|
||||
private ResourceDetailsDao<? super ResourceDetail> dao;
|
||||
|
||||
private DetailDaoHelper(ResourceObjectType resourceType) {
|
||||
if (!resourceType.resourceMetadataSupport()) {
|
||||
throw new UnsupportedOperationException("ResourceType " + resourceType + " doesn't support metadata");
|
||||
}
|
||||
this.resourceType = resourceType;
|
||||
ResourceDetailDao<?> dao = _daoMap.get(resourceType);
|
||||
ResourceDetailsDao<?> dao = _daoMap.get(resourceType);
|
||||
if (dao == null) {
|
||||
throw new UnsupportedOperationException("ResourceType " + resourceType + " doesn't support metadata");
|
||||
}
|
||||
this.dao = (ResourceDetailDao)_daoMap.get(resourceType);
|
||||
this.dao = (ResourceDetailsDao)_daoMap.get(resourceType);
|
||||
}
|
||||
|
||||
private void addDetail(ResourceDetail detail) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import com.cloud.exception.ResourceAllocationException;
|
|||
import com.cloud.server.ResourceTag;
|
||||
import com.cloud.server.TaggedResourceService;
|
||||
import com.cloud.storage.dao.VolumeDetailsDao;
|
||||
import com.cloud.vm.dao.NicDetailDao;
|
||||
import com.cloud.vm.dao.NicDetailsDao;
|
||||
|
||||
|
||||
public class ResourceMetaDataManagerTest {
|
||||
|
|
@ -47,7 +47,7 @@ public class ResourceMetaDataManagerTest {
|
|||
@Spy ResourceMetaDataManagerImpl _resourceMetaDataMgr = new ResourceMetaDataManagerImpl();
|
||||
@Mock VolumeDetailsDao _volumeDetailDao;
|
||||
@Mock
|
||||
NicDetailDao _nicDetailDao;
|
||||
NicDetailsDao _nicDetailDao;
|
||||
@Mock TaggedResourceService _taggedResourceMgr;
|
||||
|
||||
@Before
|
||||
|
|
|
|||
|
|
@ -458,3 +458,16 @@ CREATE VIEW `cloud`.`storage_pool_view` AS
|
|||
`cloud`.`async_job` ON async_job.instance_id = storage_pool.id
|
||||
and async_job.instance_type = 'StoragePool'
|
||||
and async_job.job_status = 0;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `cloud`.`vm_snapshot_details`;
|
||||
|
||||
CREATE TABLE `cloud`.`firewall_rule_details` (
|
||||
`id` bigint unsigned NOT NULL auto_increment,
|
||||
`firewall_rule_id` bigint unsigned NOT NULL COMMENT 'firewall rule id',
|
||||
`name` varchar(255) NOT NULL,
|
||||
`value` varchar(1024) NOT NULL,
|
||||
`display_detail` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'True if detail can be displayed to the end user',
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `fk_firewall_rule_details__firewall_rule_id` FOREIGN KEY `fk_firewall_rule_details__firewall_rule_id`(`firewall_rule_id`) REFERENCES `firewall_rules`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
|
|
|||
Loading…
Reference in New Issue