http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/server/src/com/cloud/api/query/ViewResponseHelper.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/query/ViewResponseHelper.java b/server/src/com/cloud/api/query/ViewResponseHelper.java index a1d1bf8..90b900c 100644 --- a/server/src/com/cloud/api/query/ViewResponseHelper.java +++ b/server/src/com/cloud/api/query/ViewResponseHelper.java @@ -30,7 +30,7 @@ import org.apache.cloudstack.api.response.DomainRouterResponse; import org.apache.cloudstack.api.response.EventResponse; import org.apache.cloudstack.api.response.HostResponse; import org.apache.cloudstack.api.response.InstanceGroupResponse; -import org.apache.cloudstack.api.response.ObjectStoreResponse; +import org.apache.cloudstack.api.response.ImageStoreResponse; import org.apache.cloudstack.api.response.ProjectAccountResponse; import org.apache.cloudstack.api.response.ProjectInvitationResponse; import org.apache.cloudstack.api.response.ProjectResponse; @@ -52,7 +52,7 @@ import com.cloud.api.query.vo.DiskOfferingJoinVO; import com.cloud.api.query.vo.DomainRouterJoinVO; import com.cloud.api.query.vo.EventJoinVO; import com.cloud.api.query.vo.HostJoinVO; -import com.cloud.api.query.vo.ImageDataStoreJoinVO; +import com.cloud.api.query.vo.ImageStoreJoinVO; import com.cloud.api.query.vo.InstanceGroupJoinVO; import com.cloud.api.query.vo.ProjectAccountJoinVO; import com.cloud.api.query.vo.ProjectInvitationJoinVO; @@ -265,11 +265,11 @@ public class ViewResponseHelper { return new ArrayList<StoragePoolResponse>(vrDataList.values()); } - public static List<ObjectStoreResponse> createObjectStoreResponse(ImageDataStoreJoinVO... stores) { - Hashtable<Long, ObjectStoreResponse> vrDataList = new Hashtable<Long, ObjectStoreResponse>(); + public static List<ImageStoreResponse> createObjectStoreResponse(ImageStoreJoinVO... stores) { + Hashtable<Long, ImageStoreResponse> vrDataList = new Hashtable<Long, ImageStoreResponse>(); // Initialise the vrdatalist with the input data - for (ImageDataStoreJoinVO vr : stores) { - ObjectStoreResponse vrData = vrDataList.get(vr.getId()); + for (ImageStoreJoinVO vr : stores) { + ImageStoreResponse vrData = vrDataList.get(vr.getId()); if ( vrData == null ){ // first time encountering this vm vrData = ApiDBUtils.newImageStoreResponse(vr); @@ -280,7 +280,7 @@ public class ViewResponseHelper { } vrDataList.put(vr.getId(), vrData); } - return new ArrayList<ObjectStoreResponse>(vrDataList.values()); + return new ArrayList<ImageStoreResponse>(vrDataList.values()); }
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/server/src/com/cloud/api/query/dao/ImageDataStoreJoinDao.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/query/dao/ImageDataStoreJoinDao.java b/server/src/com/cloud/api/query/dao/ImageDataStoreJoinDao.java deleted file mode 100644 index b92fbe6..0000000 --- a/server/src/com/cloud/api/query/dao/ImageDataStoreJoinDao.java +++ /dev/null @@ -1,36 +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.api.query.dao; - -import java.util.List; - -import org.apache.cloudstack.api.response.ObjectStoreResponse; -import com.cloud.api.query.vo.ImageDataStoreJoinVO; -import com.cloud.storage.ObjectStore; -import com.cloud.utils.db.GenericDao; - -public interface ImageDataStoreJoinDao extends GenericDao<ImageDataStoreJoinVO, Long> { - - ObjectStoreResponse newObjectStoreResponse(ImageDataStoreJoinVO os); - - ObjectStoreResponse setObjectStoreResponse(ObjectStoreResponse response, ImageDataStoreJoinVO os); - - List<ImageDataStoreJoinVO> newObjectStoreView(ObjectStore os); - - List<ImageDataStoreJoinVO> searchByIds(Long... spIds); - -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/server/src/com/cloud/api/query/dao/ImageDataStoreJoinDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/query/dao/ImageDataStoreJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/ImageDataStoreJoinDaoImpl.java deleted file mode 100644 index c58f954..0000000 --- a/server/src/com/cloud/api/query/dao/ImageDataStoreJoinDaoImpl.java +++ /dev/null @@ -1,164 +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.api.query.dao; - -import java.util.ArrayList; -import java.util.List; - -import javax.ejb.Local; -import javax.inject.Inject; - -import org.apache.cloudstack.api.response.ObjectStoreDetailResponse; -import org.apache.cloudstack.api.response.ObjectStoreResponse; -import org.apache.log4j.Logger; -import org.springframework.stereotype.Component; - -import com.cloud.api.query.vo.ImageDataStoreJoinVO; -import com.cloud.configuration.dao.ConfigurationDao; -import com.cloud.storage.ObjectStore; -import com.cloud.utils.db.GenericDaoBase; -import com.cloud.utils.db.SearchBuilder; -import com.cloud.utils.db.SearchCriteria; - - -@Component -@Local(value={ImageDataStoreJoinDao.class}) -public class ImageDataStoreJoinDaoImpl extends GenericDaoBase<ImageDataStoreJoinVO, Long> implements ImageDataStoreJoinDao { - public static final Logger s_logger = Logger.getLogger(ImageDataStoreJoinDaoImpl.class); - - @Inject - private ConfigurationDao _configDao; - - private final SearchBuilder<ImageDataStoreJoinVO> dsSearch; - - private final SearchBuilder<ImageDataStoreJoinVO> dsIdSearch; - - - protected ImageDataStoreJoinDaoImpl() { - - dsSearch = createSearchBuilder(); - dsSearch.and("idIN", dsSearch.entity().getId(), SearchCriteria.Op.IN); - dsSearch.done(); - - dsIdSearch = createSearchBuilder(); - dsIdSearch.and("id", dsIdSearch.entity().getId(), SearchCriteria.Op.EQ); - dsIdSearch.done(); - - this._count = "select count(distinct id) from image_data_store_view WHERE "; - } - - - - - - @Override - public ObjectStoreResponse newObjectStoreResponse(ImageDataStoreJoinVO ids) { - ObjectStoreResponse osResponse = new ObjectStoreResponse(); - osResponse.setId(ids.getUuid()); - osResponse.setName(ids.getName()); - osResponse.setProviderName(ids.getProviderName()); - osResponse.setProtocol(ids.getProtocol()); - osResponse.setUrl(ids.getUrl()); - osResponse.setScope(ids.getScope()); - osResponse.setZoneId(ids.getZoneUuid()); - osResponse.setZoneName(ids.getZoneName()); - osResponse.setRegionId(ids.getRegionId()); - osResponse.setRegionName(ids.getRegionName()); - - String detailName = ids.getDetailName(); - if ( detailName != null && detailName.length() > 0 ){ - ObjectStoreDetailResponse osdResponse = new ObjectStoreDetailResponse(detailName, ids.getDetailValue()); - osResponse.addDetail(osdResponse); - } - osResponse.setObjectName("objectstore"); - return osResponse; - } - - - - - - @Override - public ObjectStoreResponse setObjectStoreResponse(ObjectStoreResponse response, ImageDataStoreJoinVO ids) { - String detailName = ids.getDetailName(); - if ( detailName != null && detailName.length() > 0 ){ - ObjectStoreDetailResponse osdResponse = new ObjectStoreDetailResponse(detailName, ids.getDetailValue()); - response.addDetail(osdResponse); - } - return response; - } - - - - @Override - public List<ImageDataStoreJoinVO> newObjectStoreView(ObjectStore os) { - SearchCriteria<ImageDataStoreJoinVO> sc = dsIdSearch.create(); - sc.setParameters("id", os.getId()); - return searchIncludingRemoved(sc, null, null, false); - - } - - - - @Override - public List<ImageDataStoreJoinVO> searchByIds(Long... spIds) { - // set detail batch query size - int DETAILS_BATCH_SIZE = 2000; - String batchCfg = _configDao.getValue("detail.batch.query.size"); - if ( batchCfg != null ){ - DETAILS_BATCH_SIZE = Integer.parseInt(batchCfg); - } - // query details by batches - List<ImageDataStoreJoinVO> uvList = new ArrayList<ImageDataStoreJoinVO>(); - // query details by batches - int curr_index = 0; - if ( spIds.length > DETAILS_BATCH_SIZE ){ - while ( (curr_index + DETAILS_BATCH_SIZE ) <= spIds.length ) { - Long[] ids = new Long[DETAILS_BATCH_SIZE]; - for (int k = 0, j = curr_index; j < curr_index + DETAILS_BATCH_SIZE; j++, k++) { - ids[k] = spIds[j]; - } - SearchCriteria<ImageDataStoreJoinVO> sc = dsSearch.create(); - sc.setParameters("idIN", ids); - List<ImageDataStoreJoinVO> vms = searchIncludingRemoved(sc, null, null, false); - if (vms != null) { - uvList.addAll(vms); - } - curr_index += DETAILS_BATCH_SIZE; - } - } - if (curr_index < spIds.length) { - int batch_size = (spIds.length - curr_index); - // set the ids value - Long[] ids = new Long[batch_size]; - for (int k = 0, j = curr_index; j < curr_index + batch_size; j++, k++) { - ids[k] = spIds[j]; - } - SearchCriteria<ImageDataStoreJoinVO> sc = dsSearch.create(); - sc.setParameters("idIN", ids); - List<ImageDataStoreJoinVO> vms = searchIncludingRemoved(sc, null, null, false); - if (vms != null) { - uvList.addAll(vms); - } - } - return uvList; - } - - - - -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/server/src/com/cloud/api/query/dao/ImageStoreJoinDao.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/query/dao/ImageStoreJoinDao.java b/server/src/com/cloud/api/query/dao/ImageStoreJoinDao.java new file mode 100644 index 0000000..c1f6325 --- /dev/null +++ b/server/src/com/cloud/api/query/dao/ImageStoreJoinDao.java @@ -0,0 +1,36 @@ +// 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.api.query.dao; + +import java.util.List; + +import org.apache.cloudstack.api.response.ImageStoreResponse; +import com.cloud.api.query.vo.ImageStoreJoinVO; +import com.cloud.storage.ImageStore; +import com.cloud.utils.db.GenericDao; + +public interface ImageStoreJoinDao extends GenericDao<ImageStoreJoinVO, Long> { + + ImageStoreResponse newImageStoreResponse(ImageStoreJoinVO os); + + ImageStoreResponse setImageStoreResponse(ImageStoreResponse response, ImageStoreJoinVO os); + + List<ImageStoreJoinVO> newImageStoreView(ImageStore os); + + List<ImageStoreJoinVO> searchByIds(Long... spIds); + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/server/src/com/cloud/api/query/dao/ImageStoreJoinDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/query/dao/ImageStoreJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/ImageStoreJoinDaoImpl.java new file mode 100644 index 0000000..b2fa0c2 --- /dev/null +++ b/server/src/com/cloud/api/query/dao/ImageStoreJoinDaoImpl.java @@ -0,0 +1,163 @@ +// 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.api.query.dao; + +import java.util.ArrayList; +import java.util.List; + +import javax.ejb.Local; +import javax.inject.Inject; + +import org.apache.cloudstack.api.response.ImageStoreDetailResponse; +import org.apache.cloudstack.api.response.ImageStoreResponse; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + +import com.cloud.api.query.vo.ImageStoreJoinVO; +import com.cloud.configuration.dao.ConfigurationDao; +import com.cloud.storage.ImageStore; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; + + +@Component +@Local(value={ImageStoreJoinDao.class}) +public class ImageStoreJoinDaoImpl extends GenericDaoBase<ImageStoreJoinVO, Long> implements ImageStoreJoinDao { + public static final Logger s_logger = Logger.getLogger(ImageStoreJoinDaoImpl.class); + + @Inject + private ConfigurationDao _configDao; + + private final SearchBuilder<ImageStoreJoinVO> dsSearch; + + private final SearchBuilder<ImageStoreJoinVO> dsIdSearch; + + + protected ImageStoreJoinDaoImpl() { + + dsSearch = createSearchBuilder(); + dsSearch.and("idIN", dsSearch.entity().getId(), SearchCriteria.Op.IN); + dsSearch.done(); + + dsIdSearch = createSearchBuilder(); + dsIdSearch.and("id", dsIdSearch.entity().getId(), SearchCriteria.Op.EQ); + dsIdSearch.done(); + + this._count = "select count(distinct id) from image_data_store_view WHERE "; + } + + + + + + @Override + public ImageStoreResponse newImageStoreResponse(ImageStoreJoinVO ids) { + ImageStoreResponse osResponse = new ImageStoreResponse(); + osResponse.setId(ids.getUuid()); + osResponse.setName(ids.getName()); + osResponse.setProviderName(ids.getProviderName()); + osResponse.setProtocol(ids.getProtocol()); + osResponse.setUrl(ids.getUrl()); + osResponse.setScope(ids.getScope()); + osResponse.setZoneId(ids.getZoneUuid()); + osResponse.setZoneName(ids.getZoneName()); + osResponse.setState(ids.getState()); + + String detailName = ids.getDetailName(); + if ( detailName != null && detailName.length() > 0 ){ + ImageStoreDetailResponse osdResponse = new ImageStoreDetailResponse(detailName, ids.getDetailValue()); + osResponse.addDetail(osdResponse); + } + osResponse.setObjectName("imagestore"); + return osResponse; + } + + + + + + @Override + public ImageStoreResponse setImageStoreResponse(ImageStoreResponse response, ImageStoreJoinVO ids) { + String detailName = ids.getDetailName(); + if ( detailName != null && detailName.length() > 0 ){ + ImageStoreDetailResponse osdResponse = new ImageStoreDetailResponse(detailName, ids.getDetailValue()); + response.addDetail(osdResponse); + } + return response; + } + + + + @Override + public List<ImageStoreJoinVO> newImageStoreView(ImageStore os) { + SearchCriteria<ImageStoreJoinVO> sc = dsIdSearch.create(); + sc.setParameters("id", os.getId()); + return searchIncludingRemoved(sc, null, null, false); + + } + + + + @Override + public List<ImageStoreJoinVO> searchByIds(Long... spIds) { + // set detail batch query size + int DETAILS_BATCH_SIZE = 2000; + String batchCfg = _configDao.getValue("detail.batch.query.size"); + if ( batchCfg != null ){ + DETAILS_BATCH_SIZE = Integer.parseInt(batchCfg); + } + // query details by batches + List<ImageStoreJoinVO> uvList = new ArrayList<ImageStoreJoinVO>(); + // query details by batches + int curr_index = 0; + if ( spIds.length > DETAILS_BATCH_SIZE ){ + while ( (curr_index + DETAILS_BATCH_SIZE ) <= spIds.length ) { + Long[] ids = new Long[DETAILS_BATCH_SIZE]; + for (int k = 0, j = curr_index; j < curr_index + DETAILS_BATCH_SIZE; j++, k++) { + ids[k] = spIds[j]; + } + SearchCriteria<ImageStoreJoinVO> sc = dsSearch.create(); + sc.setParameters("idIN", ids); + List<ImageStoreJoinVO> vms = searchIncludingRemoved(sc, null, null, false); + if (vms != null) { + uvList.addAll(vms); + } + curr_index += DETAILS_BATCH_SIZE; + } + } + if (curr_index < spIds.length) { + int batch_size = (spIds.length - curr_index); + // set the ids value + Long[] ids = new Long[batch_size]; + for (int k = 0, j = curr_index; j < curr_index + batch_size; j++, k++) { + ids[k] = spIds[j]; + } + SearchCriteria<ImageStoreJoinVO> sc = dsSearch.create(); + sc.setParameters("idIN", ids); + List<ImageStoreJoinVO> vms = searchIncludingRemoved(sc, null, null, false); + if (vms != null) { + uvList.addAll(vms); + } + } + return uvList; + } + + + + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/server/src/com/cloud/api/query/vo/ImageDataStoreJoinVO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/query/vo/ImageDataStoreJoinVO.java b/server/src/com/cloud/api/query/vo/ImageDataStoreJoinVO.java deleted file mode 100644 index 5858dff..0000000 --- a/server/src/com/cloud/api/query/vo/ImageDataStoreJoinVO.java +++ /dev/null @@ -1,201 +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.api.query.vo; - -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 com.cloud.storage.ScopeType; -import org.apache.cloudstack.api.Identity; -import org.apache.cloudstack.api.InternalIdentity; - -/** - * Image Data Store DB view. - * - */ -@Entity -@Table(name="image_data_store_view") -public class ImageDataStoreJoinVO extends BaseViewVO implements InternalIdentity, Identity { - - @Id - @Column(name="id") - private long id; - - @Column(name="uuid") - private String uuid; - - @Column(name="name") - private String name; - - @Column(name="url") - private String url; - - @Column(name = "protocol") - private String protocol; - - @Column(name = "provider_name", nullable = false) - private String providerName; - - @Column(name="scope") - @Enumerated(value = EnumType.STRING) - private ScopeType scope; - - @Column(name="data_center_id") - private long zoneId; - - @Column(name="data_center_uuid") - private String zoneUuid; - - @Column(name="data_center_name") - private String zoneName; - - @Column(name="region_id") - private long regionId; - - @Column(name="region_name") - private String regionName; - - @Column(name="detail_name") - private String detailName; - - @Column(name="detail_value") - private String detailValue; - - - @Override - public long getId() { - return id; - } - - @Override - public void setId(long id) { - this.id = id; - } - - @Override - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public String getName() { - return name; - } - - - - public long getZoneId() { - return zoneId; - } - - public void setZoneId(long zoneId) { - this.zoneId = zoneId; - } - - public String getZoneUuid() { - return zoneUuid; - } - - public void setZoneUuid(String zoneUuid) { - this.zoneUuid = zoneUuid; - } - - public String getZoneName() { - return zoneName; - } - - public void setZoneName(String zoneName) { - this.zoneName = zoneName; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getProtocol() { - return protocol; - } - - public void setProtocol(String protocol) { - this.protocol = protocol; - } - - public String getProviderName() { - return providerName; - } - - public void setProviderName(String providerName) { - this.providerName = providerName; - } - - public ScopeType getScope() { - return scope; - } - - public void setScope(ScopeType scope) { - this.scope = scope; - } - - public long getRegionId() { - return regionId; - } - - public void setRegionId(long regionId) { - this.regionId = regionId; - } - - public String getRegionName() { - return regionName; - } - - public void setRegionName(String regionName) { - this.regionName = regionName; - } - - public void setName(String name) { - this.name = name; - } - - public String getDetailName() { - return detailName; - } - - public void setDetailName(String detailName) { - this.detailName = detailName; - } - - public String getDetailValue() { - return detailValue; - } - - public void setDetailValue(String detailValue) { - this.detailValue = detailValue; - } - - - -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/server/src/com/cloud/api/query/vo/ImageStoreJoinVO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/query/vo/ImageStoreJoinVO.java b/server/src/com/cloud/api/query/vo/ImageStoreJoinVO.java new file mode 100644 index 0000000..62c4a8f --- /dev/null +++ b/server/src/com/cloud/api/query/vo/ImageStoreJoinVO.java @@ -0,0 +1,193 @@ +// 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.api.query.vo; + +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 com.cloud.storage.ImageStore; +import com.cloud.storage.ScopeType; +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + +/** + * Image Data Store DB view. + * + */ +@Entity +@Table(name="image_store_view") +public class ImageStoreJoinVO extends BaseViewVO implements InternalIdentity, Identity { + + @Id + @Column(name="id") + private long id; + + @Column(name="uuid") + private String uuid; + + @Column(name="name") + private String name; + + @Column(name="url") + private String url; + + @Column(name = "protocol") + private String protocol; + + @Column(name = "provider_name", nullable = false) + private String providerName; + + @Column(name="scope") + @Enumerated(value = EnumType.STRING) + private ScopeType scope; + + @Column(name="data_center_id") + private long zoneId; + + @Column(name="data_center_uuid") + private String zoneUuid; + + @Column(name="data_center_name") + private String zoneName; + + @Column(name="state") + private ImageStore.State state; + + @Column(name="detail_name") + private String detailName; + + @Column(name="detail_value") + private String detailValue; + + + @Override + public long getId() { + return id; + } + + @Override + public void setId(long id) { + this.id = id; + } + + @Override + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getName() { + return name; + } + + + + public long getZoneId() { + return zoneId; + } + + public void setZoneId(long zoneId) { + this.zoneId = zoneId; + } + + public String getZoneUuid() { + return zoneUuid; + } + + public void setZoneUuid(String zoneUuid) { + this.zoneUuid = zoneUuid; + } + + public String getZoneName() { + return zoneName; + } + + public void setZoneName(String zoneName) { + this.zoneName = zoneName; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getProtocol() { + return protocol; + } + + public void setProtocol(String protocol) { + this.protocol = protocol; + } + + public String getProviderName() { + return providerName; + } + + public void setProviderName(String providerName) { + this.providerName = providerName; + } + + public ScopeType getScope() { + return scope; + } + + public void setScope(ScopeType scope) { + this.scope = scope; + } + + + public ImageStore.State getState() { + return state; + } + + public void setState(ImageStore.State state) { + this.state = state; + } + + public void setName(String name) { + this.name = name; + } + + public String getDetailName() { + return detailName; + } + + public void setDetailName(String detailName) { + this.detailName = detailName; + } + + public String getDetailValue() { + return detailValue; + } + + public void setDetailValue(String detailValue) { + this.detailValue = detailValue; + } + + + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/server/src/com/cloud/api/query/vo/StoragePoolJoinVO.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/api/query/vo/StoragePoolJoinVO.java b/server/src/com/cloud/api/query/vo/StoragePoolJoinVO.java index bab3990..004ba3d 100644 --- a/server/src/com/cloud/api/query/vo/StoragePoolJoinVO.java +++ b/server/src/com/cloud/api/query/vo/StoragePoolJoinVO.java @@ -25,13 +25,14 @@ import javax.persistence.Enumerated; import javax.persistence.Id; import javax.persistence.Table; import com.cloud.org.Cluster; +import com.cloud.storage.ScopeType; import com.cloud.storage.StoragePoolStatus; import com.cloud.storage.Storage.StoragePoolType; import com.cloud.utils.db.GenericDao; import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; -import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType; + /** * Storage Pool DB view. @@ -125,7 +126,7 @@ public class StoragePoolJoinVO extends BaseViewVO implements InternalIdentity, I @Column(name="job_status") private int jobStatus; - + @Column(name = "scope") @Enumerated(value = EnumType.STRING) private ScopeType scope;
