Rename TemplateTO/VolumeTO in cloud-engine-storage to

TemplateObjectTO/VolumeObjectTO to avoid name conflicting with the one
in cloud-api.
This commit is contained in:
Min Chen 2013-04-12 17:10:19 -07:00
parent b81fa6d9ea
commit 2ff01a79ca
9 changed files with 23 additions and 23 deletions

View File

@ -31,7 +31,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat; import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat;
import org.apache.cloudstack.storage.datastore.ObjectInDataStoreManager; import org.apache.cloudstack.storage.datastore.ObjectInDataStoreManager;
import org.apache.cloudstack.storage.image.manager.ImageDataManager; import org.apache.cloudstack.storage.image.manager.ImageDataManager;
import org.apache.cloudstack.storage.to.TemplateTO; import org.apache.cloudstack.storage.to.TemplateObjectTO;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import com.cloud.agent.api.Answer; import com.cloud.agent.api.Answer;
@ -187,7 +187,7 @@ public class TemplateObject implements TemplateInfo {
public DataTO getTO() { public DataTO getTO() {
DataTO to = this.dataStore.getDriver().getTO(this); DataTO to = this.dataStore.getDriver().getTO(this);
if (to == null) { if (to == null) {
to = new TemplateTO(this); to = new TemplateObjectTO(this);
} }
return to; return to;

View File

@ -25,7 +25,7 @@ import javax.inject.Inject;
import org.apache.cloudstack.storage.to.ImageStoreTO; import org.apache.cloudstack.storage.to.ImageStoreTO;
import org.apache.cloudstack.storage.to.ImageOnPrimayDataStoreTO; import org.apache.cloudstack.storage.to.ImageOnPrimayDataStoreTO;
import org.apache.cloudstack.storage.to.PrimaryDataStoreTO; import org.apache.cloudstack.storage.to.PrimaryDataStoreTO;
import org.apache.cloudstack.storage.to.TemplateTO; import org.apache.cloudstack.storage.to.TemplateObjectTO;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@ -134,7 +134,7 @@ public class DirectAgentTest extends CloudStackTestNGBase {
ImageStoreTO imageStore = Mockito.mock(ImageStoreTO.class); ImageStoreTO imageStore = Mockito.mock(ImageStoreTO.class);
Mockito.when(imageStore.getType()).thenReturn("http"); Mockito.when(imageStore.getType()).thenReturn("http");
TemplateTO template = Mockito.mock(TemplateTO.class); TemplateObjectTO template = Mockito.mock(TemplateObjectTO.class);
Mockito.when(template.getPath()).thenReturn(this.getTemplateUrl()); Mockito.when(template.getPath()).thenReturn(this.getTemplateUrl());
Mockito.when(template.getImageDataStore()).thenReturn(imageStore); Mockito.when(template.getImageDataStore()).thenReturn(imageStore);

View File

@ -19,20 +19,20 @@
package org.apache.cloudstack.storage.command; package org.apache.cloudstack.storage.command;
import org.apache.cloudstack.storage.to.ImageOnPrimayDataStoreTO; import org.apache.cloudstack.storage.to.ImageOnPrimayDataStoreTO;
import org.apache.cloudstack.storage.to.VolumeTO; import org.apache.cloudstack.storage.to.VolumeObjectTO;
import com.cloud.agent.api.Command; import com.cloud.agent.api.Command;
public class CreateVolumeFromBaseImageCommand extends Command implements StorageSubSystemCommand { public class CreateVolumeFromBaseImageCommand extends Command implements StorageSubSystemCommand {
private final VolumeTO volume; private final VolumeObjectTO volume;
private final ImageOnPrimayDataStoreTO image; private final ImageOnPrimayDataStoreTO image;
public CreateVolumeFromBaseImageCommand(VolumeTO volume, String image) { public CreateVolumeFromBaseImageCommand(VolumeObjectTO volume, String image) {
this.volume = volume; this.volume = volume;
this.image = null; this.image = null;
} }
public VolumeTO getVolume() { public VolumeObjectTO getVolume() {
return this.volume; return this.volume;
} }

View File

@ -18,7 +18,7 @@
*/ */
package org.apache.cloudstack.storage.command; package org.apache.cloudstack.storage.command;
import org.apache.cloudstack.storage.to.VolumeTO; import org.apache.cloudstack.storage.to.VolumeObjectTO;
import com.cloud.agent.api.Command; import com.cloud.agent.api.Command;

View File

@ -23,11 +23,11 @@ import org.apache.cloudstack.storage.volume.TemplateOnPrimaryDataStoreInfo;
public class ImageOnPrimayDataStoreTO { public class ImageOnPrimayDataStoreTO {
private final String pathOnPrimaryDataStore; private final String pathOnPrimaryDataStore;
private PrimaryDataStoreTO dataStore; private PrimaryDataStoreTO dataStore;
private final TemplateTO template; private final TemplateObjectTO template;
public ImageOnPrimayDataStoreTO(TemplateOnPrimaryDataStoreInfo template) { public ImageOnPrimayDataStoreTO(TemplateOnPrimaryDataStoreInfo template) {
this.pathOnPrimaryDataStore = template.getPath(); this.pathOnPrimaryDataStore = template.getPath();
//this.dataStore = template.getPrimaryDataStore().getDataStoreTO(); //this.dataStore = template.getPrimaryDataStore().getDataStoreTO();
this.template = new TemplateTO(template.getTemplate()); this.template = new TemplateObjectTO(template.getTemplate());
} }
public String getPathOnPrimaryDataStore() { public String getPathOnPrimaryDataStore() {
@ -38,7 +38,7 @@ public class ImageOnPrimayDataStoreTO {
return this.dataStore; return this.dataStore;
} }
public TemplateTO getTemplate() { public TemplateObjectTO getTemplate() {
return this.template; return this.template;
} }
} }

View File

@ -23,14 +23,14 @@ import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat; import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat;
import org.apache.cloudstack.storage.image.datastore.ImageStoreInfo; import org.apache.cloudstack.storage.image.datastore.ImageStoreInfo;
public class TemplateTO implements DataTO { public class TemplateObjectTO implements DataTO {
private final String path; private final String path;
private final String uuid; private final String uuid;
private DiskFormat diskType; private DiskFormat diskType;
private final ImageStoreTO imageDataStore; private final ImageStoreTO imageDataStore;
private final String name; private final String name;
public TemplateTO(TemplateInfo template) { public TemplateObjectTO(TemplateInfo template) {
this.path = template.getUri(); this.path = template.getUri();
this.uuid = template.getUuid(); this.uuid = template.getUuid();
//this.diskType = template.getDiskType(); //this.diskType = template.getDiskType();

View File

@ -23,7 +23,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat; import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat;
import org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeType; import org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeType;
public class VolumeTO implements DataTO { public class VolumeObjectTO implements DataTO {
private final String uuid; private final String uuid;
private final String path; private final String path;
private VolumeType volumeType; private VolumeType volumeType;
@ -31,7 +31,7 @@ public class VolumeTO implements DataTO {
private PrimaryDataStoreTO dataStore; private PrimaryDataStoreTO dataStore;
private String name; private String name;
private final long size; private final long size;
public VolumeTO(VolumeInfo volume) { public VolumeObjectTO(VolumeInfo volume) {
this.uuid = volume.getUuid(); this.uuid = volume.getUuid();
this.path = volume.getUri(); this.path = volume.getUri();
//this.volumeType = volume.getType(); //this.volumeType = volume.getType();

View File

@ -29,7 +29,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreState
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat; import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat;
import org.apache.cloudstack.storage.datastore.ObjectInDataStoreManager; import org.apache.cloudstack.storage.datastore.ObjectInDataStoreManager;
import org.apache.cloudstack.storage.to.VolumeTO; import org.apache.cloudstack.storage.to.VolumeObjectTO;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import com.cloud.agent.api.Answer; import com.cloud.agent.api.Answer;
@ -339,7 +339,7 @@ public class VolumeObject implements VolumeInfo {
public DataTO getTO() { public DataTO getTO() {
DataTO to = this.getDataStore().getDriver().getTO(this); DataTO to = this.getDataStore().getDriver().getTO(this);
if (to == null) { if (to == null) {
to = new VolumeTO(this); to = new VolumeObjectTO(this);
} }
return to; return to;
} }

View File

@ -47,8 +47,8 @@ import org.apache.cloudstack.storage.datastore.protocol.DataStoreProtocol;
import org.apache.cloudstack.storage.to.ImageOnPrimayDataStoreTO; import org.apache.cloudstack.storage.to.ImageOnPrimayDataStoreTO;
import org.apache.cloudstack.storage.to.ImageStoreTO; import org.apache.cloudstack.storage.to.ImageStoreTO;
import org.apache.cloudstack.storage.to.PrimaryDataStoreTO; import org.apache.cloudstack.storage.to.PrimaryDataStoreTO;
import org.apache.cloudstack.storage.to.TemplateTO; import org.apache.cloudstack.storage.to.TemplateObjectTO;
import org.apache.cloudstack.storage.to.VolumeTO; import org.apache.cloudstack.storage.to.VolumeObjectTO;
import org.apache.http.HttpEntity; import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse; import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException; import org.apache.http.client.ClientProtocolException;
@ -194,7 +194,7 @@ public class XenServerStorageResource {
} }
protected Answer execute(DeleteVolumeCommand cmd) { protected Answer execute(DeleteVolumeCommand cmd) {
VolumeTO volume = null; VolumeObjectTO volume = null;
Connection conn = hypervisorResource.getConnection(); Connection conn = hypervisorResource.getConnection();
String errorMsg = null; String errorMsg = null;
try { try {
@ -216,7 +216,7 @@ public class XenServerStorageResource {
} }
protected Answer execute(CreateVolumeFromBaseImageCommand cmd) { protected Answer execute(CreateVolumeFromBaseImageCommand cmd) {
VolumeTO volume = cmd.getVolume(); VolumeObjectTO volume = cmd.getVolume();
ImageOnPrimayDataStoreTO baseImage = cmd.getImage(); ImageOnPrimayDataStoreTO baseImage = cmd.getImage();
Connection conn = hypervisorResource.getConnection(); Connection conn = hypervisorResource.getConnection();
@ -683,7 +683,7 @@ public class XenServerStorageResource {
try { try {
if (srcStore.getRole() == DataStoreRole.ImageCache && srcData.getObjectType() == DataObjectType.TEMPLATE) { if (srcStore.getRole() == DataStoreRole.ImageCache && srcData.getObjectType() == DataObjectType.TEMPLATE) {
ImageStoreTO srcImageStore = (ImageStoreTO)srcStore; ImageStoreTO srcImageStore = (ImageStoreTO)srcStore;
TemplateTO srcTemplate = (TemplateTO)srcData; TemplateObjectTO srcTemplate = (TemplateObjectTO)srcData;
String storeUrl = srcImageStore.getUri(); String storeUrl = srcImageStore.getUri();
if (!storeUrl.startsWith("nfs")) { if (!storeUrl.startsWith("nfs")) {
return new PrimaryStorageDownloadAnswer("only nfs image cache store supported"); return new PrimaryStorageDownloadAnswer("only nfs image cache store supported");