incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject [4/8] starting unit test
Date Wed, 21 Nov 2012 03:01:19 GMT
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/image/format/ImageFormatHelper.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/format/ImageFormatHelper.java b/engine/storage/src/org/apache/cloudstack/storage/image/format/ImageFormatHelper.java
index 6ecb9b0..9523d24 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/format/ImageFormatHelper.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/format/ImageFormatHelper.java
@@ -26,19 +26,20 @@ import org.springframework.stereotype.Component;
 
 @Component
 public class ImageFormatHelper {
-	private static List<ImageFormat> formats;
-	private static final ImageFormat defaultFormat = new Unknown();
-	@Inject
-	public void setFormats(List<ImageFormat> formats) {
-		ImageFormatHelper.formats = formats;
-	}
-	
-	public static ImageFormat getFormat(String format) {
-		for(ImageFormat fm : formats) {
-			if (fm.equals(format)) {
-				return fm;
-			}
-		}
-		return ImageFormatHelper.defaultFormat;
-	}
+    private static List<ImageFormat> formats;
+    private static final ImageFormat defaultFormat = new Unknown();
+
+    @Inject
+    public void setFormats(List<ImageFormat> formats) {
+        ImageFormatHelper.formats = formats;
+    }
+
+    public static ImageFormat getFormat(String format) {
+        for (ImageFormat fm : formats) {
+            if (fm.equals(format)) {
+                return fm;
+            }
+        }
+        return ImageFormatHelper.defaultFormat;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/image/format/OVA.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/format/OVA.java b/engine/storage/src/org/apache/cloudstack/storage/image/format/OVA.java
index 46f77a0..77a355a 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/format/OVA.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/format/OVA.java
@@ -23,9 +23,10 @@ import org.springframework.stereotype.Component;
 
 @Component
 public class OVA extends BaseType implements ImageFormat {
-	private final String type = "OVA";
-	@Override
-	public String toString() {
-		return type;
-	}
+    private final String type = "OVA";
+
+    @Override
+    public String toString() {
+        return type;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/image/format/QCOW2.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/format/QCOW2.java b/engine/storage/src/org/apache/cloudstack/storage/image/format/QCOW2.java
index 9e13ebb..d51052b 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/format/QCOW2.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/format/QCOW2.java
@@ -23,9 +23,10 @@ import org.springframework.stereotype.Component;
 
 @Component("imageformat_qcow2")
 public class QCOW2 extends BaseType implements ImageFormat {
-	private final String type = "QCOW2";
-	@Override
-	public String toString() {
-		return type;
-	}
+    private final String type = "QCOW2";
+
+    @Override
+    public String toString() {
+        return type;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/image/format/Unknown.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/format/Unknown.java b/engine/storage/src/org/apache/cloudstack/storage/image/format/Unknown.java
index 341be64..992654e 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/format/Unknown.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/format/Unknown.java
@@ -23,10 +23,10 @@ import org.springframework.stereotype.Component;
 
 @Component
 public class Unknown extends BaseType implements ImageFormat {
-	private final String type = "Unknown";
-	
-	@Override
-	public String toString() {
-		return type;
-	}
+    private final String type = "Unknown";
+
+    @Override
+    public String toString() {
+        return type;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/image/format/VHD.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/format/VHD.java b/engine/storage/src/org/apache/cloudstack/storage/image/format/VHD.java
index 4a02e5f..f979ac3 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/format/VHD.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/format/VHD.java
@@ -19,11 +19,14 @@
 package org.apache.cloudstack.storage.image.format;
 
 import org.apache.cloudstack.storage.BaseType;
+import org.springframework.stereotype.Component;
 
+@Component
 public class VHD extends BaseType implements ImageFormat {
-	private final String type = "VHD";
-	@Override
-	public String toString() {
-		return type;
-	}
+    private final String type = "VHD";
+
+    @Override
+    public String toString() {
+        return type;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManager.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManager.java b/engine/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManager.java
index 878e394..e1dce50 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManager.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManager.java
@@ -21,5 +21,5 @@ package org.apache.cloudstack.storage.image.manager;
 import org.apache.cloudstack.storage.image.store.ImageDataStore;
 
 public interface ImageDataStoreManager {
-	ImageDataStore getImageDataStore(long dataStoreId);
+    ImageDataStore getImageDataStore(long dataStoreId);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManagerImpl.java b/engine/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManagerImpl.java
index ce9e78c..ebd60f1 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManagerImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManagerImpl.java
@@ -27,15 +27,16 @@ import org.apache.cloudstack.storage.image.db.ImageDataStoreVO;
 import org.apache.cloudstack.storage.image.store.ImageDataStore;
 
 public class ImageDataStoreManagerImpl implements ImageDataStoreManager {
-	@Inject
-	ImageDataStoreDao dataStoreDao;
-	@Inject
-	ImageDataDao imageDataDao;
-	@Override
-	public ImageDataStore getImageDataStore(long dataStoreId) {
-		ImageDataStoreVO dataStore = dataStoreDao.findById(dataStoreId);
-		// TODO Auto-generated method stub
-		return null;
-	}
+    @Inject
+    ImageDataStoreDao dataStoreDao;
+    @Inject
+    ImageDataDao imageDataDao;
+
+    @Override
+    public ImageDataStore getImageDataStore(long dataStoreId) {
+        ImageDataStoreVO dataStore = dataStoreDao.findById(dataStoreId);
+        // TODO Auto-generated method stub
+        return null;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/image/motion/DefaultImageMotionStrategy.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/motion/DefaultImageMotionStrategy.java b/engine/storage/src/org/apache/cloudstack/storage/image/motion/DefaultImageMotionStrategy.java
index 14fe466..7ec63e0 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/motion/DefaultImageMotionStrategy.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/motion/DefaultImageMotionStrategy.java
@@ -29,27 +29,29 @@ import org.apache.cloudstack.storage.to.ImageOnPrimayDataStoreTO;
 import org.apache.cloudstack.storage.to.TemplateTO;
 import org.apache.cloudstack.storage.to.VolumeTO;
 import org.apache.cloudstack.storage.volume.TemplateOnPrimaryDataStoreInfo;
+import org.springframework.stereotype.Component;
 
+@Component
 public class DefaultImageMotionStrategy implements ImageMotionStrategy {
 
-	@Override
-	public boolean canHandle(TemplateOnPrimaryDataStoreInfo templateStore) {
-		// TODO Auto-generated method stub
-		return true;
-	}
+    @Override
+    public boolean canHandle(TemplateOnPrimaryDataStoreInfo templateStore) {
+        // TODO Auto-generated method stub
+        return true;
+    }
 
-	@Override
-	public EndPoint getEndPoint(TemplateOnPrimaryDataStoreInfo templateStore) {
-		PrimaryDataStoreInfo pdi = templateStore.getPrimaryDataStore();
-		return pdi.getEndPoints().get(0);
-	}
+    @Override
+    public EndPoint getEndPoint(TemplateOnPrimaryDataStoreInfo templateStore) {
+        PrimaryDataStoreInfo pdi = templateStore.getPrimaryDataStore();
+        return pdi.getEndPoints().get(0);
+    }
 
-	@Override
-	public boolean copyTemplate(TemplateOnPrimaryDataStoreInfo templateStore, EndPoint ep) {
-		ImageOnPrimayDataStoreTO imageTo = new ImageOnPrimayDataStoreTO(templateStore);
-		CopyTemplateToPrimaryStorage copyCommand = new CopyTemplateToPrimaryStorage(imageTo);
-		ep.sendMessage(copyCommand);
-		return true;
-	}
+    @Override
+    public boolean copyTemplate(TemplateOnPrimaryDataStoreInfo templateStore, EndPoint ep) {
+        ImageOnPrimayDataStoreTO imageTo = new ImageOnPrimayDataStoreTO(templateStore);
+        CopyTemplateToPrimaryStorage copyCommand = new CopyTemplateToPrimaryStorage(imageTo);
+        ep.sendMessage(copyCommand);
+        return true;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/image/motion/ImageMotionService.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/motion/ImageMotionService.java b/engine/storage/src/org/apache/cloudstack/storage/image/motion/ImageMotionService.java
index 8351d39..9f48115 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/motion/ImageMotionService.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/motion/ImageMotionService.java
@@ -21,6 +21,7 @@ package org.apache.cloudstack.storage.image.motion;
 import org.apache.cloudstack.storage.volume.TemplateOnPrimaryDataStoreInfo;
 
 public interface ImageMotionService {
-	boolean copyTemplate(TemplateOnPrimaryDataStoreInfo templateStore);
-	boolean copyIso(String isoUri, String destIsoUri);
+    boolean copyTemplate(TemplateOnPrimaryDataStoreInfo templateStore);
+
+    boolean copyIso(String isoUri, String destIsoUri);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/image/motion/ImageMotionServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/motion/ImageMotionServiceImpl.java b/engine/storage/src/org/apache/cloudstack/storage/image/motion/ImageMotionServiceImpl.java
index a4e6e40..3cf5efc 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/motion/ImageMotionServiceImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/motion/ImageMotionServiceImpl.java
@@ -31,41 +31,44 @@ import org.apache.cloudstack.storage.image.ImageService;
 import org.apache.cloudstack.storage.image.TemplateInfo;
 import org.apache.cloudstack.storage.volume.TemplateOnPrimaryDataStoreInfo;
 import org.apache.cloudstack.storage.volume.VolumeService;
+import org.springframework.stereotype.Component;
 
 import com.cloud.utils.exception.CloudRuntimeException;
 
+@Component
 public class ImageMotionServiceImpl implements ImageMotionService {
-	@Inject
-	List<ImageMotionStrategy> motionStrategies;
-	@Inject
-	VolumeService volumeService;
-	@Inject
-	ImageService imageService;
-	@Override
-	public boolean copyIso(String isoUri, String destIsoUri) {
-		// TODO Auto-generated method stub
-		return false;
-	}
+    @Inject
+    List<ImageMotionStrategy> motionStrategies;
+    @Inject
+    VolumeService volumeService;
+    @Inject
+    ImageService imageService;
 
-	@Override
-	public boolean copyTemplate(TemplateOnPrimaryDataStoreInfo templateStore) {
-		ImageMotionStrategy ims = null;
-		for (ImageMotionStrategy strategy : motionStrategies) {
-			if (strategy.canHandle(templateStore)) {
-				ims = strategy;
-				break;
-			}
-		}
-		
-		if (ims == null) {
-			throw new CloudRuntimeException("Can't find proper image motion strategy");
-		}
-		
-		EndPoint ep = ims.getEndPoint(templateStore);
-		
-		volumeService.grantAccess(templateStore, ep);
-		TemplateInfo template = templateStore.getTemplate();
-		imageService.grantTemplateAccess(template, ep);
-		return ims.copyTemplate(templateStore, ep);
-	}
+    @Override
+    public boolean copyIso(String isoUri, String destIsoUri) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean copyTemplate(TemplateOnPrimaryDataStoreInfo templateStore) {
+        ImageMotionStrategy ims = null;
+        for (ImageMotionStrategy strategy : motionStrategies) {
+            if (strategy.canHandle(templateStore)) {
+                ims = strategy;
+                break;
+            }
+        }
+
+        if (ims == null) {
+            throw new CloudRuntimeException("Can't find proper image motion strategy");
+        }
+
+        EndPoint ep = ims.getEndPoint(templateStore);
+
+        volumeService.grantAccess(templateStore, ep);
+        TemplateInfo template = templateStore.getTemplate();
+        imageService.grantTemplateAccess(template, ep);
+        return ims.copyTemplate(templateStore, ep);
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/image/motion/ImageMotionStrategy.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/motion/ImageMotionStrategy.java b/engine/storage/src/org/apache/cloudstack/storage/image/motion/ImageMotionStrategy.java
index 7e5de7d..e1df9e2 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/motion/ImageMotionStrategy.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/motion/ImageMotionStrategy.java
@@ -22,7 +22,9 @@ import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
 import org.apache.cloudstack.storage.volume.TemplateOnPrimaryDataStoreInfo;
 
 public interface ImageMotionStrategy {
-   public boolean canHandle(TemplateOnPrimaryDataStoreInfo templateStore);      
-   public EndPoint getEndPoint(TemplateOnPrimaryDataStoreInfo templateStore);
-   public boolean copyTemplate(TemplateOnPrimaryDataStoreInfo templateStore, EndPoint ep);
+    public boolean canHandle(TemplateOnPrimaryDataStoreInfo templateStore);
+
+    public EndPoint getEndPoint(TemplateOnPrimaryDataStoreInfo templateStore);
+
+    public boolean copyTemplate(TemplateOnPrimaryDataStoreInfo templateStore, EndPoint ep);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/image/provider/DefaultImageDataStoreProvider.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/provider/DefaultImageDataStoreProvider.java b/engine/storage/src/org/apache/cloudstack/storage/image/provider/DefaultImageDataStoreProvider.java
index 2953f0b..bfb915f 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/provider/DefaultImageDataStoreProvider.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/provider/DefaultImageDataStoreProvider.java
@@ -31,23 +31,29 @@ import org.springframework.stereotype.Component;
 
 @Component
 public class DefaultImageDataStoreProvider implements ImageDataStoreProvider {
-	private final String providerName = "DefaultProvider";
-	@Inject
-	ImageDataStoreProviderDao providerDao;
-	@Inject
-	ImageDataStoreDao imageStoreDao;
-	
-	@Override
-	public ImageDataStore getImageDataStore(long imageStoreId) {
-		ImageDataStoreVO idsv = imageStoreDao.findById(imageStoreId);
-		ImageDataStoreDriver driver = new ImageDataStoreDriverImpl();
-		ImageDataStore ids = new ImageDataStoreImpl(idsv, driver, false, null);
-		return ids;
-	}
+    private final String providerName = "DefaultProvider";
+    @Inject
+    ImageDataStoreProviderDao providerDao;
+    @Inject
+    ImageDataStoreDao imageStoreDao;
 
-	@Override
-	public String getName() {
-		return providerName;
-	}
+    @Override
+    public ImageDataStore getImageDataStore(long imageStoreId) {
+        ImageDataStoreVO idsv = imageStoreDao.findById(imageStoreId);
+        ImageDataStoreDriver driver = new ImageDataStoreDriverImpl();
+        ImageDataStore ids = new ImageDataStoreImpl(idsv, driver, false, null);
+        return ids;
+    }
+
+    @Override
+    public String getName() {
+        return providerName;
+    }
+
+    @Override
+    public boolean register(long providerId) {
+        // TODO Auto-generated method stub
+        return true;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProvider.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProvider.java b/engine/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProvider.java
index 495c652..8776827 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProvider.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProvider.java
@@ -21,6 +21,7 @@ package org.apache.cloudstack.storage.image.provider;
 import org.apache.cloudstack.storage.image.store.ImageDataStore;
 
 public interface ImageDataStoreProvider {
-	ImageDataStore getImageDataStore(long imageStoreId);
-	public String getName();
+    ImageDataStore getImageDataStore(long imageStoreId);
+    boolean register(long providerId);
+    public String getName();
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProviderManager.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProviderManager.java b/engine/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProviderManager.java
index 407a644..2359a27 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProviderManager.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProviderManager.java
@@ -21,9 +21,12 @@ package org.apache.cloudstack.storage.image.provider;
 import org.apache.cloudstack.storage.image.TemplateObject;
 import org.apache.cloudstack.storage.image.store.ImageDataStore;
 
-public interface ImageDataStoreProviderManager {
-	public ImageDataStoreProvider getProvider(long providerId);
-	public ImageDataStore getDataStore(long dataStoreId);
-	public ImageDataStore getDataStoreFromTemplateId(long templateId);
-	public TemplateObject getTemplate(long templateId);
+import com.cloud.utils.component.Manager;
+
+public interface ImageDataStoreProviderManager extends Manager {
+    public ImageDataStoreProvider getProvider(long providerId);
+
+    public ImageDataStore getDataStore(Long dataStoreId);
+
+    public ImageDataStore getDataStoreFromTemplateId(long templateId);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProviderManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProviderManagerImpl.java b/engine/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProviderManagerImpl.java
index 62ef8e1..602973a 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProviderManagerImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProviderManagerImpl.java
@@ -19,8 +19,10 @@
 package org.apache.cloudstack.storage.image.provider;
 
 import java.util.List;
+import java.util.Map;
 
 import javax.inject.Inject;
+import javax.naming.ConfigurationException;
 
 import org.apache.cloudstack.storage.image.TemplateObject;
 import org.apache.cloudstack.storage.image.db.ImageDataDao;
@@ -34,47 +36,94 @@ import org.springframework.stereotype.Component;
 
 @Component
 public class ImageDataStoreProviderManagerImpl implements ImageDataStoreProviderManager {
-	@Inject
-	ImageDataStoreProviderDao providerDao;
-	@Inject
-	ImageDataStoreDao dataStoreDao;
-	@Inject
-	ImageDataDao imageDataDao;
-	@Inject
-	List<ImageDataStoreProvider> providers;
-	@Override
-	public ImageDataStoreProvider getProvider(long providerId) {
-		
-		return null;
-	}
-	
-	protected ImageDataStoreProvider getProvider(String name) {
-		for (ImageDataStoreProvider provider : providers) {
-			if (provider.getName().equalsIgnoreCase(name)) {
-				return provider;
-			}
-		}
-		return null;
-	}
-	
-	@Override
-	public ImageDataStore getDataStore(long dataStoreId) {
-		ImageDataStoreVO idsv = dataStoreDao.findById(dataStoreId);
-		long providerId = idsv.getProvider();
-		ImageDataStoreProviderVO idspv = providerDao.findById(providerId);
-		ImageDataStoreProvider provider = getProvider(idspv.getName());
-		return provider.getImageDataStore(dataStoreId);
-	}
+    @Inject
+    ImageDataStoreProviderDao providerDao;
+    @Inject
+    ImageDataStoreDao dataStoreDao;
+    @Inject
+    ImageDataDao imageDataDao;
+    @Inject
+    List<ImageDataStoreProvider> providers;
 
-	@Override
-	public ImageDataStore getDataStoreFromTemplateId(long templateId) {
-		ImageDataVO iddv = imageDataDao.findById(templateId);
-		return getDataStore(iddv.getId());
-	}
+    @Override
+    public ImageDataStoreProvider getProvider(long providerId) {
 
-	@Override
-	public TemplateObject getTemplate(long templateId) {
-		// TODO Auto-generated method stub
-		return null;
-	}
+        return null;
+    }
+
+    protected ImageDataStoreProvider getProvider(String name) {
+        for (ImageDataStoreProvider provider : providers) {
+            if (provider.getName().equalsIgnoreCase(name)) {
+                return provider;
+            }
+        }
+        return null;
+    }
+
+    @Override
+    public ImageDataStore getDataStore(Long dataStoreId) {
+        if (dataStoreId == null) {
+            return null;
+        }
+
+        ImageDataStoreVO idsv = dataStoreDao.findById(dataStoreId);
+        if (idsv == null) {
+            return null;
+        }
+        
+        long providerId = idsv.getProvider();
+        ImageDataStoreProviderVO idspv = providerDao.findById(providerId);
+        ImageDataStoreProvider provider = getProvider(idspv.getName());
+        return provider.getImageDataStore(dataStoreId);
+    }
+
+    @Override
+    public ImageDataStore getDataStoreFromTemplateId(long templateId) {
+        ImageDataVO iddv = imageDataDao.findById(templateId);
+        return getDataStore(iddv.getImageDataStoreId());
+    }
+
+    @Override
+    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
+        List<ImageDataStoreProviderVO> existingProviders = providerDao.listAll();
+        //TODO: hold global lock
+        boolean foundExistingProvider = false;
+        for (ImageDataStoreProvider provider : providers) {
+            foundExistingProvider = false;
+           for (ImageDataStoreProviderVO existingProvider : existingProviders) {
+               if (provider.getName().equalsIgnoreCase(existingProvider.getName())) {
+                   foundExistingProvider = true;
+                   break;
+               }
+           }
+           
+           if (!foundExistingProvider) {
+               //add a new provider into db
+               ImageDataStoreProviderVO nProvider = new ImageDataStoreProviderVO();
+               nProvider.setName(provider.getName());
+               nProvider = providerDao.persist(nProvider);
+               provider.register(nProvider.getId());
+           }
+        }
+       
+        return true;
+    }
+
+    @Override
+    public boolean start() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public boolean stop() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public String getName() {
+        // TODO Auto-generated method stub
+        return null;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStore.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStore.java b/engine/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStore.java
index 5422bad..6e97c83 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStore.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStore.java
@@ -19,14 +19,21 @@
 package org.apache.cloudstack.storage.image.store;
 
 import org.apache.cloudstack.storage.image.TemplateInfo;
+import org.apache.cloudstack.storage.image.TemplateObject;
 import org.apache.cloudstack.storage.image.downloader.ImageDownloader;
 
 public interface ImageDataStore extends ImageDataStoreInfo {
-	TemplateInfo registerTemplate(long templateId);
-	String grantAccess(long templateId, long endPointId);
-	boolean revokeAccess(long templateId, long endPointId);
-	boolean deleteTemplate(long templateId);
-	boolean needDownloadToCacheStorage();
-	
-	ImageDownloader getImageDownloader();
+    TemplateObject registerTemplate(long templateId);
+
+    String grantAccess(long templateId, long endPointId);
+
+    boolean revokeAccess(long templateId, long endPointId);
+
+    boolean deleteTemplate(long templateId);
+
+    boolean needDownloadToCacheStorage();
+
+    ImageDownloader getImageDownloader();
+    
+    TemplateObject getTemplate(long templateId);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStoreImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStoreImpl.java b/engine/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStoreImpl.java
index dbe37d5..8f1b373 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStoreImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStoreImpl.java
@@ -21,6 +21,7 @@ package org.apache.cloudstack.storage.image.store;
 import javax.inject.Inject;
 
 import org.apache.cloudstack.storage.image.TemplateInfo;
+import org.apache.cloudstack.storage.image.TemplateObject;
 import org.apache.cloudstack.storage.image.db.ImageDataDao;
 import org.apache.cloudstack.storage.image.db.ImageDataStoreDao;
 import org.apache.cloudstack.storage.image.db.ImageDataStoreVO;
@@ -29,72 +30,76 @@ import org.apache.cloudstack.storage.image.downloader.ImageDownloader;
 import org.apache.cloudstack.storage.image.driver.ImageDataStoreDriver;
 
 public class ImageDataStoreImpl implements ImageDataStore {
-	@Inject
-	ImageDataDao imageDao;
-	ImageDataStoreDriver driver;
-	ImageDownloader downloader;
-	ImageDataStoreVO imageDataStoreVO;
-	boolean needDownloadToCacheStorage = false;
-	
-	
-	public ImageDataStoreImpl(ImageDataStoreVO dataStoreVO, ImageDataStoreDriver driver, boolean needDownloadToCacheStorage, ImageDownloader downloader) {
-		this.driver = driver;
-		this.needDownloadToCacheStorage = needDownloadToCacheStorage;
-		this.downloader = downloader;
-		this.imageDataStoreVO = dataStoreVO;
-	}
-	/*
-	@Override
-	public TemplateInfo registerTemplate(long templateId) {
-		ImageDataVO idv = imageDao.findById(templateId);
-		TemplateInfo template = new TemplateInfo(this, idv);
-		if (driver.registerTemplate(template)) {
-			template.setImageDataStoreId(imageDataStoreVO.getId());
-			return template;
-		} else {
-			return null;
-		}
-	}*/
+    @Inject
+    ImageDataDao imageDao;
+    ImageDataStoreDriver driver;
+    ImageDownloader downloader;
+    ImageDataStoreVO imageDataStoreVO;
+    boolean needDownloadToCacheStorage = false;
 
-	@Override
-	public String grantAccess(long templateId, long endPointId) {
-		ImageDataVO idv = imageDao.findById(templateId);
-		return idv.getUrl();
-	}
+    public ImageDataStoreImpl(ImageDataStoreVO dataStoreVO, ImageDataStoreDriver driver, boolean needDownloadToCacheStorage, ImageDownloader downloader) {
+        this.driver = driver;
+        this.needDownloadToCacheStorage = needDownloadToCacheStorage;
+        this.downloader = downloader;
+        this.imageDataStoreVO = dataStoreVO;
+    }
 
-	@Override
-	public boolean revokeAccess(long templateId, long endPointId) {
-		// TODO Auto-generated method stub
-		return false;
-	}
+    /*
+     * @Override public TemplateInfo registerTemplate(long templateId) {
+     * ImageDataVO idv = imageDao.findById(templateId); TemplateInfo template =
+     * new TemplateInfo(this, idv); if (driver.registerTemplate(template)) {
+     * template.setImageDataStoreId(imageDataStoreVO.getId()); return template;
+     * } else { return null; } }
+     */
 
-	@Override
-	public boolean deleteTemplate(long templateId) {
-		// TODO Auto-generated method stub
-		return false;
-	}
+    @Override
+    public String grantAccess(long templateId, long endPointId) {
+        ImageDataVO idv = imageDao.findById(templateId);
+        return idv.getUrl();
+    }
 
-	@Override
-	public boolean needDownloadToCacheStorage() {
-		// TODO Auto-generated method stub
-		return false;
-	}
+    @Override
+    public boolean revokeAccess(long templateId, long endPointId) {
+        // TODO Auto-generated method stub
+        return false;
+    }
 
-	@Override
-	public ImageDownloader getImageDownloader() {
-		return this.downloader;
-	}
+    @Override
+    public boolean deleteTemplate(long templateId) {
+        // TODO Auto-generated method stub
+        return false;
+    }
 
-	@Override
-	public long getImageDataStoreId() {
-		// TODO Auto-generated method stub
-		return 0;
-	}
+    @Override
+    public boolean needDownloadToCacheStorage() {
+        // TODO Auto-generated method stub
+        return false;
+    }
 
-	@Override
-	public TemplateInfo registerTemplate(long templateId) {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    @Override
+    public ImageDownloader getImageDownloader() {
+        return this.downloader;
+    }
+
+    @Override
+    public long getImageDataStoreId() {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public TemplateObject registerTemplate(long templateId) {
+        ImageDataVO image = imageDao.findById(templateId);
+        image.setImageDataStoreId(this.getImageDataStoreId());
+        imageDao.update(templateId, image);
+        return getTemplate(templateId);
+    }
+
+    @Override
+    public TemplateObject getTemplate(long templateId) {
+        ImageDataVO image = imageDao.findById(templateId);
+        TemplateObject to = new TemplateObject(image, this);
+        return to;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStoreInfo.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStoreInfo.java b/engine/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStoreInfo.java
index 7be4da0..a5d3d0f 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStoreInfo.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStoreInfo.java
@@ -19,5 +19,5 @@
 package org.apache.cloudstack.storage.image.store;
 
 public interface ImageDataStoreInfo {
-	public long getImageDataStoreId();
+    public long getImageDataStoreId();
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultNfsSecondaryLifeCycle.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultNfsSecondaryLifeCycle.java b/engine/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultNfsSecondaryLifeCycle.java
index 2786a99..4c71e43 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultNfsSecondaryLifeCycle.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultNfsSecondaryLifeCycle.java
@@ -22,33 +22,35 @@ import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreLifeCycle;
 
 public class DefaultNfsSecondaryLifeCycle implements DataStoreLifeCycle {
-	protected DataStore _ds;
-	public DefaultNfsSecondaryLifeCycle(DataStore ds) {
-		_ds = ds;
-	}
-	public void add() {
-		// TODO Auto-generated method stub
+    protected DataStore _ds;
 
-	}
+    public DefaultNfsSecondaryLifeCycle(DataStore ds) {
+        _ds = ds;
+    }
 
-	public void delete() {
-		// TODO Auto-generated method stub
+    public void add() {
+        // TODO Auto-generated method stub
 
-	}
+    }
 
-	public void enable() {
-		// TODO Auto-generated method stub
+    public void delete() {
+        // TODO Auto-generated method stub
 
-	}
+    }
 
-	public void disable() {
-		// TODO Auto-generated method stub
+    public void enable() {
+        // TODO Auto-generated method stub
 
-	}
+    }
 
-	public void processEvent(DataStoreEvent event, Object... objs) {
-		// TODO Auto-generated method stub
+    public void disable() {
+        // TODO Auto-generated method stub
 
-	}
+    }
+
+    public void processEvent(DataStoreEvent event, Object... objs) {
+        // TODO Auto-generated method stub
+
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultPrimaryDataStoreLifeCycle.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultPrimaryDataStoreLifeCycle.java b/engine/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultPrimaryDataStoreLifeCycle.java
index f837bcc..098c56a 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultPrimaryDataStoreLifeCycle.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/lifecycle/DefaultPrimaryDataStoreLifeCycle.java
@@ -26,98 +26,98 @@ import com.cloud.utils.component.Inject;
 import com.cloud.utils.exception.CloudRuntimeException;
 
 public class DefaultPrimaryDataStoreLifeCycle implements DataStoreLifeCycle {
-	 private static final Logger s_logger = Logger.getLogger(DataStoreLifeCycle.class);
-	private DataStore _ds;
-	@Inject
-	StoragePoolDao _storagePoolDao;
-	@Inject
-	StoragePoolHostDao _poolHostDao;
-	public DefaultPrimaryDataStoreLifeCycle(DataStore ds) {
-		this._ds = ds;
-	}
-	
-
-	protected boolean createStoragePool(DataStoreEndPoint ep, StoragePoolVO pool) {
-		DataStoreDriver dsDriver = _ds.getDataStoreDriver();
-		CreateStoragePoolCommand cmd = new CreateStoragePoolCommand(true, pool);
-		final Answer answer = dsDriver.sendMessage(ep, cmd);
-		if (answer != null && answer.getResult()) {
-			return true;
-		} else {
-			throw new CloudRuntimeException(answer.getDetails());
-		}
-	}
-	
-	 protected void connectHostToSharedPool(DataStoreEndPoint ep, StoragePoolVO pool) throws StorageUnavailableException {
-		 DataStoreDriver dsDriver = _ds.getDataStoreDriver();
-		 long hostId = ep.getHostId();
-		 ModifyStoragePoolCommand cmd = new ModifyStoragePoolCommand(true, pool);
-		 final Answer answer = dsDriver.sendMessage(ep, cmd);
-
-		 if (answer == null) {
-			 throw new StorageUnavailableException("Unable to get an answer to the modify storage pool command", pool.getId());
-		 }
-
-		 if (!answer.getResult()) {
-			 throw new StorageUnavailableException("Unable establish connection from storage head to storage pool " + pool.getId() + " due to " + answer.getDetails(), pool.getId());
-		 }
-
-		 assert (answer instanceof ModifyStoragePoolAnswer) : "Well, now why won't you actually return the ModifyStoragePoolAnswer when it's ModifyStoragePoolCommand? Pool=" + pool.getId();
-		 ModifyStoragePoolAnswer mspAnswer = (ModifyStoragePoolAnswer) answer;
-
-		 StoragePoolHostVO poolHost = _poolHostDao.findByPoolHost(pool.getId(), hostId);
-		 if (poolHost == null) {
-			 poolHost = new StoragePoolHostVO(pool.getId(), hostId, mspAnswer.getPoolInfo().getLocalPath().replaceAll("//", "/"));
-			 _poolHostDao.persist(poolHost);
-		 } else {
-			 poolHost.setLocalPath(mspAnswer.getPoolInfo().getLocalPath().replaceAll("//", "/"));
-		 }
-		 pool.setAvailableBytes(mspAnswer.getPoolInfo().getAvailableBytes());
-		 pool.setCapacityBytes(mspAnswer.getPoolInfo().getCapacityBytes());
-		 _storagePoolDao.update(pool.getId(), pool);
-	 }
-
-	 public void add() {
-		 DataStoreEndPointSelector dseps = _ds.getEndPointSelector();
-		 List<DataStoreEndPoint> dsep = dseps.getEndPoints(null);
-		 boolean success = false;
-		 StoragePoolVO spool = _storagePoolDao.findById(_ds.getId());
-		 for (DataStoreEndPoint ep : dsep) {
-			 success = createStoragePool(ep, spool);
-			 if (success) {
-				 break;
-			 }
-		 }
-
-		 List<DataStoreEndPoint> poolHosts = new ArrayList<DataStoreEndPoint>();
-		 for (DataStoreEndPoint ep : dsep) {
-			 try {
-				 connectHostToSharedPool(ep, spool);
-				 poolHosts.add(ep);
-			 } catch (Exception e) {
-				 s_logger.debug("Failed to add storage on this ep: " + ep.getHostId());
-			 }
-		 }
-	}
-
-	public void delete() {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void enable() {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void disable() {
-		// TODO Auto-generated method stub
-
-	}
-
-	public void processEvent(DataStoreEvent event, Object... objs) {
-		// TODO Auto-generated method stub
-
-	}
+    private static final Logger s_logger = Logger.getLogger(DataStoreLifeCycle.class);
+    private DataStore _ds;
+    @Inject
+    StoragePoolDao _storagePoolDao;
+    @Inject
+    StoragePoolHostDao _poolHostDao;
+
+    public DefaultPrimaryDataStoreLifeCycle(DataStore ds) {
+        this._ds = ds;
+    }
+
+    protected boolean createStoragePool(DataStoreEndPoint ep, StoragePoolVO pool) {
+        DataStoreDriver dsDriver = _ds.getDataStoreDriver();
+        CreateStoragePoolCommand cmd = new CreateStoragePoolCommand(true, pool);
+        final Answer answer = dsDriver.sendMessage(ep, cmd);
+        if (answer != null && answer.getResult()) {
+            return true;
+        } else {
+            throw new CloudRuntimeException(answer.getDetails());
+        }
+    }
+
+    protected void connectHostToSharedPool(DataStoreEndPoint ep, StoragePoolVO pool) throws StorageUnavailableException {
+        DataStoreDriver dsDriver = _ds.getDataStoreDriver();
+        long hostId = ep.getHostId();
+        ModifyStoragePoolCommand cmd = new ModifyStoragePoolCommand(true, pool);
+        final Answer answer = dsDriver.sendMessage(ep, cmd);
+
+        if (answer == null) {
+            throw new StorageUnavailableException("Unable to get an answer to the modify storage pool command", pool.getId());
+        }
+
+        if (!answer.getResult()) {
+            throw new StorageUnavailableException("Unable establish connection from storage head to storage pool " + pool.getId() + " due to " + answer.getDetails(), pool.getId());
+        }
+
+        assert (answer instanceof ModifyStoragePoolAnswer) : "Well, now why won't you actually return the ModifyStoragePoolAnswer when it's ModifyStoragePoolCommand? Pool=" + pool.getId();
+        ModifyStoragePoolAnswer mspAnswer = (ModifyStoragePoolAnswer) answer;
+
+        StoragePoolHostVO poolHost = _poolHostDao.findByPoolHost(pool.getId(), hostId);
+        if (poolHost == null) {
+            poolHost = new StoragePoolHostVO(pool.getId(), hostId, mspAnswer.getPoolInfo().getLocalPath().replaceAll("//", "/"));
+            _poolHostDao.persist(poolHost);
+        } else {
+            poolHost.setLocalPath(mspAnswer.getPoolInfo().getLocalPath().replaceAll("//", "/"));
+        }
+        pool.setAvailableBytes(mspAnswer.getPoolInfo().getAvailableBytes());
+        pool.setCapacityBytes(mspAnswer.getPoolInfo().getCapacityBytes());
+        _storagePoolDao.update(pool.getId(), pool);
+    }
+
+    public void add() {
+        DataStoreEndPointSelector dseps = _ds.getEndPointSelector();
+        List<DataStoreEndPoint> dsep = dseps.getEndPoints(null);
+        boolean success = false;
+        StoragePoolVO spool = _storagePoolDao.findById(_ds.getId());
+        for (DataStoreEndPoint ep : dsep) {
+            success = createStoragePool(ep, spool);
+            if (success) {
+                break;
+            }
+        }
+
+        List<DataStoreEndPoint> poolHosts = new ArrayList<DataStoreEndPoint>();
+        for (DataStoreEndPoint ep : dsep) {
+            try {
+                connectHostToSharedPool(ep, spool);
+                poolHosts.add(ep);
+            } catch (Exception e) {
+                s_logger.debug("Failed to add storage on this ep: " + ep.getHostId());
+            }
+        }
+    }
+
+    public void delete() {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void enable() {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void disable() {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void processEvent(DataStoreEvent event, Object... objs) {
+        // TODO Auto-generated method stub
+
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/manager/BackupStorageManager.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/manager/BackupStorageManager.java b/engine/storage/src/org/apache/cloudstack/storage/manager/BackupStorageManager.java
index 77375ab..fe28ce9 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/manager/BackupStorageManager.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/manager/BackupStorageManager.java
@@ -27,13 +27,17 @@ import com.cloud.template.VirtualMachineTemplate;
 import com.cloud.utils.fsm.NoTransitionException;
 
 public interface BackupStorageManager {
-	boolean contains(Volume vol);
-	boolean contains(Snapshot snapshot);
-	boolean contains(VirtualMachineTemplate template);
-	
-	DataStore getBackupDataStore(Volume vol);
-	DataStore getBackupDataStore(Snapshot snapshot);
-	DataStore getBackupDataStore(VirtualMachineTemplate template);
-	
-	boolean updateOperationState(Volume vol, DataObjectBackupStorageOperationState.Event event) throws NoTransitionException;
+    boolean contains(Volume vol);
+
+    boolean contains(Snapshot snapshot);
+
+    boolean contains(VirtualMachineTemplate template);
+
+    DataStore getBackupDataStore(Volume vol);
+
+    DataStore getBackupDataStore(Snapshot snapshot);
+
+    DataStore getBackupDataStore(VirtualMachineTemplate template);
+
+    boolean updateOperationState(Volume vol, DataObjectBackupStorageOperationState.Event event) throws NoTransitionException;
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/manager/BackupStorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/manager/BackupStorageManagerImpl.java b/engine/storage/src/org/apache/cloudstack/storage/manager/BackupStorageManagerImpl.java
index 9a6b629..49bc673 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/manager/BackupStorageManagerImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/manager/BackupStorageManagerImpl.java
@@ -28,39 +28,39 @@ import com.cloud.utils.fsm.NoTransitionException;
 
 public class BackupStorageManagerImpl implements BackupStorageManager {
 
-	public boolean contains(Volume vol) {
-		// TODO Auto-generated method stub
-		return false;
-	}
+    public boolean contains(Volume vol) {
+        // TODO Auto-generated method stub
+        return false;
+    }
 
-	public boolean contains(Snapshot snapshot) {
-		// TODO Auto-generated method stub
-		return false;
-	}
+    public boolean contains(Snapshot snapshot) {
+        // TODO Auto-generated method stub
+        return false;
+    }
 
-	public boolean contains(VirtualMachineTemplate template) {
-		// TODO Auto-generated method stub
-		return false;
-	}
+    public boolean contains(VirtualMachineTemplate template) {
+        // TODO Auto-generated method stub
+        return false;
+    }
 
-	public DataStore getBackupDataStore(Volume vol) {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    public DataStore getBackupDataStore(Volume vol) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
-	public DataStore getBackupDataStore(Snapshot snapshot) {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    public DataStore getBackupDataStore(Snapshot snapshot) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
-	public DataStore getBackupDataStore(VirtualMachineTemplate template) {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    public DataStore getBackupDataStore(VirtualMachineTemplate template) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
-	public boolean updateOperationState(Volume vol, Event event) throws NoTransitionException {
-		// TODO Auto-generated method stub
-		return false;
-	}
+    public boolean updateOperationState(Volume vol, Event event) throws NoTransitionException {
+        // TODO Auto-generated method stub
+        return false;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/manager/PrimaryDataStoreManager.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/manager/PrimaryDataStoreManager.java b/engine/storage/src/org/apache/cloudstack/storage/manager/PrimaryDataStoreManager.java
index 6292ab8..3745e67 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/manager/PrimaryDataStoreManager.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/manager/PrimaryDataStoreManager.java
@@ -27,16 +27,17 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.storage.StoragePool;
 
 public interface PrimaryDataStoreManager {
-	PrimaryDataStore addDataStore(long zoneId, long podId, long clusterId, long hostId, 
-			String URI, 
-			String storageType,
-			String poolName,
-			String storageProviderName,
-			Map<String, String> params);
-	void deleteStoragePool(long poolId);
-	void enableStoragePool(long poolId);
-	void disableStoragePool(long poolId);
-	Map<String, List<String>> getSupportedPrimaryStorages(long zoneId, HypervisorType hypervisor);
-	Map<String, List<String>> getSupportedSecondaryStorages(long zoneId);
-	PrimaryDataStore getDataStore(String id);
+    PrimaryDataStore addDataStore(long zoneId, long podId, long clusterId, long hostId, String URI, String storageType, String poolName, String storageProviderName, Map<String, String> params);
+
+    void deleteStoragePool(long poolId);
+
+    void enableStoragePool(long poolId);
+
+    void disableStoragePool(long poolId);
+
+    Map<String, List<String>> getSupportedPrimaryStorages(long zoneId, HypervisorType hypervisor);
+
+    Map<String, List<String>> getSupportedSecondaryStorages(long zoneId);
+
+    PrimaryDataStore getDataStore(String id);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/manager/PrimaryDataStoreManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/manager/PrimaryDataStoreManagerImpl.java b/engine/storage/src/org/apache/cloudstack/storage/manager/PrimaryDataStoreManagerImpl.java
index 2af2ef0..6c3ce74 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/manager/PrimaryDataStoreManagerImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/manager/PrimaryDataStoreManagerImpl.java
@@ -43,61 +43,61 @@ import com.cloud.utils.component.Inject;
 import com.cloud.utils.exception.CloudRuntimeException;
 
 public class PrimaryDataStoreManagerImpl implements PrimaryDataStoreManager {
-	@Inject(adapter = StorageProvider.class)
-	protected Adapters<StorageProvider> _storageProviders;
-	@Inject
-	protected DataCenterDao _dcDao;
-	@Inject
-	protected HostPodDao _podDao;
-	@Inject
-	protected ClusterDao _clusterDao;
-	@Inject
-	protected StoragePoolDao _storagePoolDao;
-
-	public void deleteStoragePool(long poolId) {
-		StoragePool spool = _storagePoolDao.findById(poolId);
-		StorageProvider sp = findStorageProvider(spool.getStorageProvider());
-		DataStore ds = sp.getDataStore(spool);
-		DataStoreLifeCycle dslc = ds.getLifeCycle();
-		dslc.delete();
-	}
-
-	public void enableStoragePool(long poolId) {
-		// TODO Auto-generated method stub
-		
-	}
-
-	public void disableStoragePool(long poolId) {
-		// TODO Auto-generated method stub
-		
-	}
-
-	public Map<String, List<String>> getSupportedPrimaryStorages(long zoneId, HypervisorType hypervisor) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public Map<String, List<String>> getSupportedSecondaryStorages(long zoneId) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-	
-	protected StorageProvider findStorageProvider(String name) {
-		Iterator<StorageProvider> spIter = _storageProviders.iterator();
-		StorageProvider sp = null;
-		while (spIter.hasNext()) {
-			sp = spIter.next();
-			if (sp.getProviderName().equalsIgnoreCase(name)) {
-				break;
-			}
-		}
-		
-		return sp;
-	}
-	
-	public StoragePool addStoragePool(long zoneId, long podId, long clusterId, long hostId, String URI, String storageType, String poolName, String storageProviderName, Map<String, String> params) {
-		StoragePoolVO spool = new StoragePoolVO();
-		long poolId = _storagePoolDao.getNextInSequence(Long.class, "id");
+    @Inject(adapter = StorageProvider.class)
+    protected Adapters<StorageProvider> _storageProviders;
+    @Inject
+    protected DataCenterDao _dcDao;
+    @Inject
+    protected HostPodDao _podDao;
+    @Inject
+    protected ClusterDao _clusterDao;
+    @Inject
+    protected StoragePoolDao _storagePoolDao;
+
+    public void deleteStoragePool(long poolId) {
+        StoragePool spool = _storagePoolDao.findById(poolId);
+        StorageProvider sp = findStorageProvider(spool.getStorageProvider());
+        DataStore ds = sp.getDataStore(spool);
+        DataStoreLifeCycle dslc = ds.getLifeCycle();
+        dslc.delete();
+    }
+
+    public void enableStoragePool(long poolId) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public void disableStoragePool(long poolId) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public Map<String, List<String>> getSupportedPrimaryStorages(long zoneId, HypervisorType hypervisor) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Map<String, List<String>> getSupportedSecondaryStorages(long zoneId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    protected StorageProvider findStorageProvider(String name) {
+        Iterator<StorageProvider> spIter = _storageProviders.iterator();
+        StorageProvider sp = null;
+        while (spIter.hasNext()) {
+            sp = spIter.next();
+            if (sp.getProviderName().equalsIgnoreCase(name)) {
+                break;
+            }
+        }
+
+        return sp;
+    }
+
+    public StoragePool addStoragePool(long zoneId, long podId, long clusterId, long hostId, String URI, String storageType, String poolName, String storageProviderName, Map<String, String> params) {
+        StoragePoolVO spool = new StoragePoolVO();
+        long poolId = _storagePoolDao.getNextInSequence(Long.class, "id");
         spool.setId(poolId);
         spool.setDataCenterId(zoneId);
         spool.setPodId(podId);
@@ -107,36 +107,36 @@ public class PrimaryDataStoreManagerImpl implements PrimaryDataStoreManager {
         spool.setStorageType(storageType);
         spool.setStatus(StoragePoolStatus.Creating);
         spool = _storagePoolDao.persist(spool);
-        
+
         StorageProvider sp = findStorageProvider(storageProviderName);
-        DataStore ds = sp.addDataStore((StoragePool)spool, URI, params);
-        
+        DataStore ds = sp.addDataStore((StoragePool) spool, URI, params);
+
         DataStoreLifeCycle dslc = ds.getLifeCycle();
         try {
-        	dslc.add();
+            dslc.add();
         } catch (CloudRuntimeException e) {
-        	_storagePoolDao.remove(spool.getId());
-        	throw e;
+            _storagePoolDao.remove(spool.getId());
+            throw e;
         }
-     
+
         spool.setPath(ds.getURI());
         spool.setUuid(ds.getUUID());
         spool.setStatus(StoragePoolStatus.Up);
         _storagePoolDao.update(spool.getId(), spool);
         spool = _storagePoolDao.findById(spool.getId());
         return spool;
-	}
-
-	@Override
-	public PrimaryDataStore addDataStore(long zoneId, long podId, long clusterId, long hostId, String URI, String storageType, String poolName, String storageProviderName, Map<String, String> params) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public PrimaryDataStore getDataStore(String id) {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    }
+
+    @Override
+    public PrimaryDataStore addDataStore(long zoneId, long podId, long clusterId, long hostId, String URI, String storageType, String poolName, String storageProviderName, Map<String, String> params) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public PrimaryDataStore getDataStore(String id) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/manager/SecondaryStorageManager.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/manager/SecondaryStorageManager.java b/engine/storage/src/org/apache/cloudstack/storage/manager/SecondaryStorageManager.java
index 3eda0cb..fb6baf6 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/manager/SecondaryStorageManager.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/manager/SecondaryStorageManager.java
@@ -27,8 +27,11 @@ import com.cloud.storage.Volume;
 import com.cloud.template.VirtualMachineTemplate;
 
 public interface SecondaryStorageManager {
-	DataStore getStore(Volume volume);
-	DataStore getImageStore(DataStore destStore);
-	List<DataStore> getImageStores(long zoneId);
-	DataStore getStore(Snapshot snapshot);
+    DataStore getStore(Volume volume);
+
+    DataStore getImageStore(DataStore destStore);
+
+    List<DataStore> getImageStores(long zoneId);
+
+    DataStore getStore(Snapshot snapshot);
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/manager/SecondaryStorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/manager/SecondaryStorageManagerImpl.java b/engine/storage/src/org/apache/cloudstack/storage/manager/SecondaryStorageManagerImpl.java
index 7b4e29c..5c58bd7 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/manager/SecondaryStorageManagerImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/manager/SecondaryStorageManagerImpl.java
@@ -27,29 +27,29 @@ import com.cloud.storage.Volume;
 import com.cloud.storage.dao.VMTemplateZoneDao;
 
 public class SecondaryStorageManagerImpl implements SecondaryStorageManager {
-	public DataStore getStore(Volume volume) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public DataStore getImageStore(DataStore destStore) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public List<DataStore> getImageStores() {
-		
-		return null;
-	}
-
-	public DataStore getStore(Snapshot snapshot) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public List<DataStore> getImageStores(long zoneId) {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    public DataStore getStore(Volume volume) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public DataStore getImageStore(DataStore destStore) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public List<DataStore> getImageStores() {
+
+        return null;
+    }
+
+    public DataStore getStore(Snapshot snapshot) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public List<DataStore> getImageStores(long zoneId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/provider/DefaultNfsSecondaryStorageProvider.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/provider/DefaultNfsSecondaryStorageProvider.java b/engine/storage/src/org/apache/cloudstack/storage/provider/DefaultNfsSecondaryStorageProvider.java
index 19ffae8..0d375fa 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/provider/DefaultNfsSecondaryStorageProvider.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/provider/DefaultNfsSecondaryStorageProvider.java
@@ -39,91 +39,92 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.storage.StoragePool;
 
 public class DefaultNfsSecondaryStorageProvider implements StorageProvider {
-	private String _name = DefaultPrimaryStorageProvider.class.toString();
-	protected Map<HypervisorType, Map<String, DataStoreConfigurator>> _supportedProtocols;
-	public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
-		Map<String, DataStoreConfigurator> dscs = new HashMap<String, DataStoreConfigurator>();
-		DataStoreConfigurator nfsdc = null;
-		dscs.put(nfsdc.getProtocol(), nfsdc);
-	
-		_supportedProtocols.put(HypervisorType.XenServer, dscs);
-		_supportedProtocols.put(HypervisorType.KVM, dscs);
-		_supportedProtocols.put(HypervisorType.VMware, dscs);
-		_supportedProtocols.put(HypervisorType.Ovm, dscs);
-		return true;
-	}
-
-	public String getName() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public boolean start() {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	public boolean stop() {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	public List<HypervisorType> supportedHypervisors() {
-		List<HypervisorType> hypervisors = new ArrayList<HypervisorType>();
-		Set<HypervisorType> hyps = _supportedProtocols.keySet();
-		
-		for (HypervisorType hy : hyps) {
-			hypervisors.add(hy);
-		}
-		
-		return hypervisors;
-	}
-
-	public String getProviderName() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public void configure(Map<String, String> storeProviderInfo) {
-		// TODO Auto-generated method stub
-
-	}
-
-	public DataStore addDataStore(StoragePool sp, String url, Map<String, String> params) {
-		URI uri;
-		try {
-			uri = new URI(url);
-		} catch (URISyntaxException e) {
-			throw new InvalidParameterValueException("invalide url" + url);
-		}
-		
-		String protocol = uri.getScheme();
-		if (protocol == null) {
-			throw new InvalidParameterValueException("the protocol can't be null");
-		}
-		
-		DataStoreConfigurator dscf = _supportedProtocols.get(HypervisorType.XenServer).get(protocol);
-		Map<String, String> configs = dscf.getConfigs(uri, params);
-		dscf.validate(configs);
-		DataStore ds = dscf.getDataStore(sp);
-		return ds;
-	}
-
-	public DataStore getDataStore(StoragePool pool) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public Map<HypervisorType, Map<String, DataStoreConfigurator>> getDataStoreConfigs() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public List<StoreType> supportedStoreTypes() {
-		List<StoreType> types = new ArrayList<StoreType>();
-		types.add(StoreType.Image);
-		types.add(StoreType.Backup);
-		return types;
-	}
+    private String _name = DefaultPrimaryStorageProvider.class.toString();
+    protected Map<HypervisorType, Map<String, DataStoreConfigurator>> _supportedProtocols;
+
+    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
+        Map<String, DataStoreConfigurator> dscs = new HashMap<String, DataStoreConfigurator>();
+        DataStoreConfigurator nfsdc = null;
+        dscs.put(nfsdc.getProtocol(), nfsdc);
+
+        _supportedProtocols.put(HypervisorType.XenServer, dscs);
+        _supportedProtocols.put(HypervisorType.KVM, dscs);
+        _supportedProtocols.put(HypervisorType.VMware, dscs);
+        _supportedProtocols.put(HypervisorType.Ovm, dscs);
+        return true;
+    }
+
+    public String getName() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public boolean start() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public boolean stop() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public List<HypervisorType> supportedHypervisors() {
+        List<HypervisorType> hypervisors = new ArrayList<HypervisorType>();
+        Set<HypervisorType> hyps = _supportedProtocols.keySet();
+
+        for (HypervisorType hy : hyps) {
+            hypervisors.add(hy);
+        }
+
+        return hypervisors;
+    }
+
+    public String getProviderName() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void configure(Map<String, String> storeProviderInfo) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public DataStore addDataStore(StoragePool sp, String url, Map<String, String> params) {
+        URI uri;
+        try {
+            uri = new URI(url);
+        } catch (URISyntaxException e) {
+            throw new InvalidParameterValueException("invalide url" + url);
+        }
+
+        String protocol = uri.getScheme();
+        if (protocol == null) {
+            throw new InvalidParameterValueException("the protocol can't be null");
+        }
+
+        DataStoreConfigurator dscf = _supportedProtocols.get(HypervisorType.XenServer).get(protocol);
+        Map<String, String> configs = dscf.getConfigs(uri, params);
+        dscf.validate(configs);
+        DataStore ds = dscf.getDataStore(sp);
+        return ds;
+    }
+
+    public DataStore getDataStore(StoragePool pool) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Map<HypervisorType, Map<String, DataStoreConfigurator>> getDataStoreConfigs() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public List<StoreType> supportedStoreTypes() {
+        List<StoreType> types = new ArrayList<StoreType>();
+        types.add(StoreType.Image);
+        types.add(StoreType.Backup);
+        return types;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/provider/DefaultPrimaryStorageProvider.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/provider/DefaultPrimaryStorageProvider.java b/engine/storage/src/org/apache/cloudstack/storage/provider/DefaultPrimaryStorageProvider.java
index fc88a1f..a5f7317 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/provider/DefaultPrimaryStorageProvider.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/provider/DefaultPrimaryStorageProvider.java
@@ -30,113 +30,112 @@ import com.cloud.storage.StoragePoolVO;
 import com.cloud.storage.dao.StoragePoolDao;
 
 public class DefaultPrimaryStorageProvider implements StorageProvider {
-	private String _name = DefaultPrimaryStorageProvider.class.toString();
-	static Map<HypervisorType, Map<String, DataStoreConfigurator>> _supportedProtocols;
-	@Inject
-	protected ClusterDao _clusterDao;
-	
-	public List<HypervisorType> supportedHypervisors() {
-		List<HypervisorType> hypervisors = new ArrayList<HypervisorType>();
-		hypervisors.add(Hypervisor.HypervisorType.XenServer);
-		return hypervisors;
-	}
-	
-	public DefaultPrimaryStorageProvider() {
-		Map<String, DataStoreConfigurator> dscs = new HashMap<String, DataStoreConfigurator>();
-		DataStoreConfigurator nfsdc = null;
-		dscs.put(nfsdc.getProtocol(), nfsdc);
-	
-		_supportedProtocols.put(HypervisorType.XenServer, dscs);
-	}
-
-	public List<StoreType> supportedStoreType() {
-		List<StoreType> type = new ArrayList<StoreType>();
-		type.add(StoreType.Primary);
-		return type;
-	}
-
-	public void configure(Map<String, String> storeProviderInfo) {
-		// TODO Auto-generated method stub
-
-	}
-
-	public Map<HypervisorType, Map<String,DataStoreConfigurator>> getDataStoreConfigs() {
-		return _supportedProtocols;
-	}
-
-	public String getProviderName() {
-		return _name;
-	}
-
-	public DataStore createDataStore(HypervisorType hypervisor,
-			DataStoreConfigurator dsc) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-	
-	public DataStore getDataStore(StoragePool pool) {
-		ClusterVO clu = _clusterDao.findById(pool.getClusterId());
-		HypervisorType hy = clu.getHypervisorType();
-		Map<String, DataStoreConfigurator> dscs = _supportedProtocols.get(hy);
-		DataStoreConfigurator dsc = dscs.get(pool.getPoolType().toString());
-		return dsc.getDataStore(pool);
-	}
-
-	public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	public String getName() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public boolean start() {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	public boolean stop() {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	public DataStore addDataStore(StoragePool spool, String url, Map<String, String> params) {
-		URI uri;
-		try {
-			uri = new URI(url);
-		} catch (URISyntaxException e) {
-			throw new InvalidParameterValueException("invalide url" + url);
-		}
-
-		String protocol = uri.getScheme();
-		if (protocol == null) {
-			throw new InvalidParameterValueException("the protocol can't be null");
-		}
-		
-		ClusterVO cluster = _clusterDao.findById(spool.getClusterId());
-
-		Map<String, DataStoreConfigurator> dscs = _supportedProtocols.get(cluster.getHypervisorType());
-		if (dscs.isEmpty()) {
-			throw new InvalidParameterValueException("Doesn't support this hypervisor");
-		}
-
-		DataStoreConfigurator dsc = dscs.get(protocol);
-		if (dsc == null) {
-			throw new InvalidParameterValueException("Doesn't support this protocol");
-		}
-		
-		Map<String, String> configs = dsc.getConfigs(uri, params);
-		dsc.validate(configs);
-		DataStore ds = dsc.getDataStore(spool);
-		
-		return ds;
-	}
-
-	public List<StoreType> supportedStoreTypes() {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    private String _name = DefaultPrimaryStorageProvider.class.toString();
+    static Map<HypervisorType, Map<String, DataStoreConfigurator>> _supportedProtocols;
+    @Inject
+    protected ClusterDao _clusterDao;
+
+    public List<HypervisorType> supportedHypervisors() {
+        List<HypervisorType> hypervisors = new ArrayList<HypervisorType>();
+        hypervisors.add(Hypervisor.HypervisorType.XenServer);
+        return hypervisors;
+    }
+
+    public DefaultPrimaryStorageProvider() {
+        Map<String, DataStoreConfigurator> dscs = new HashMap<String, DataStoreConfigurator>();
+        DataStoreConfigurator nfsdc = null;
+        dscs.put(nfsdc.getProtocol(), nfsdc);
+
+        _supportedProtocols.put(HypervisorType.XenServer, dscs);
+    }
+
+    public List<StoreType> supportedStoreType() {
+        List<StoreType> type = new ArrayList<StoreType>();
+        type.add(StoreType.Primary);
+        return type;
+    }
+
+    public void configure(Map<String, String> storeProviderInfo) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public Map<HypervisorType, Map<String, DataStoreConfigurator>> getDataStoreConfigs() {
+        return _supportedProtocols;
+    }
+
+    public String getProviderName() {
+        return _name;
+    }
+
+    public DataStore createDataStore(HypervisorType hypervisor, DataStoreConfigurator dsc) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public DataStore getDataStore(StoragePool pool) {
+        ClusterVO clu = _clusterDao.findById(pool.getClusterId());
+        HypervisorType hy = clu.getHypervisorType();
+        Map<String, DataStoreConfigurator> dscs = _supportedProtocols.get(hy);
+        DataStoreConfigurator dsc = dscs.get(pool.getPoolType().toString());
+        return dsc.getDataStore(pool);
+    }
+
+    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public String getName() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public boolean start() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public boolean stop() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public DataStore addDataStore(StoragePool spool, String url, Map<String, String> params) {
+        URI uri;
+        try {
+            uri = new URI(url);
+        } catch (URISyntaxException e) {
+            throw new InvalidParameterValueException("invalide url" + url);
+        }
+
+        String protocol = uri.getScheme();
+        if (protocol == null) {
+            throw new InvalidParameterValueException("the protocol can't be null");
+        }
+
+        ClusterVO cluster = _clusterDao.findById(spool.getClusterId());
+
+        Map<String, DataStoreConfigurator> dscs = _supportedProtocols.get(cluster.getHypervisorType());
+        if (dscs.isEmpty()) {
+            throw new InvalidParameterValueException("Doesn't support this hypervisor");
+        }
+
+        DataStoreConfigurator dsc = dscs.get(protocol);
+        if (dsc == null) {
+            throw new InvalidParameterValueException("Doesn't support this protocol");
+        }
+
+        Map<String, String> configs = dsc.getConfigs(uri, params);
+        dsc.validate(configs);
+        DataStore ds = dsc.getDataStore(spool);
+
+        return ds;
+    }
+
+    public List<StoreType> supportedStoreTypes() {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/provider/HttpImageStoreProvider.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/provider/HttpImageStoreProvider.java b/engine/storage/src/org/apache/cloudstack/storage/provider/HttpImageStoreProvider.java
index 96e1219..846ff7a 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/provider/HttpImageStoreProvider.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/provider/HttpImageStoreProvider.java
@@ -33,59 +33,59 @@ import com.cloud.storage.StoragePool;
 
 public class HttpImageStoreProvider implements StorageProvider {
 
-	public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	public String getName() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public boolean start() {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	public boolean stop() {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	public List<HypervisorType> supportedHypervisors() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public String getProviderName() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public List<StoreType> supportedStoreTypes() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public void configure(Map<String, String> storeProviderInfo) {
-		// TODO Auto-generated method stub
-
-	}
-
-	public DataStore addDataStore(StoragePool sp, String uri, Map<String, String> params) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public DataStore getDataStore(StoragePool pool) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public Map<HypervisorType, Map<String, DataStoreConfigurator>> getDataStoreConfigs() {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public String getName() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public boolean start() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public boolean stop() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public List<HypervisorType> supportedHypervisors() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getProviderName() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public List<StoreType> supportedStoreTypes() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void configure(Map<String, String> storeProviderInfo) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public DataStore addDataStore(StoragePool sp, String uri, Map<String, String> params) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public DataStore getDataStore(StoragePool pool) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Map<HypervisorType, Map<String, DataStoreConfigurator>> getDataStoreConfigs() {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/provider/S3SecondaryStorageProvider.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/provider/S3SecondaryStorageProvider.java b/engine/storage/src/org/apache/cloudstack/storage/provider/S3SecondaryStorageProvider.java
index 83f8a1f..d21e5e0 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/provider/S3SecondaryStorageProvider.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/provider/S3SecondaryStorageProvider.java
@@ -33,59 +33,59 @@ import com.cloud.storage.StoragePool;
 
 public class S3SecondaryStorageProvider implements StorageProvider {
 
-	public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	public String getName() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public boolean start() {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	public boolean stop() {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	public List<HypervisorType> supportedHypervisors() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public String getProviderName() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public List<StoreType> supportedStoreTypes() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public void configure(Map<String, String> storeProviderInfo) {
-		// TODO Auto-generated method stub
-
-	}
-
-	public DataStore addDataStore(StoragePool sp, String uri, Map<String, String> params) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public DataStore getDataStore(StoragePool pool) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public Map<HypervisorType, Map<String, DataStoreConfigurator>> getDataStoreConfigs() {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public String getName() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public boolean start() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public boolean stop() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public List<HypervisorType> supportedHypervisors() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getProviderName() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public List<StoreType> supportedStoreTypes() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void configure(Map<String, String> storeProviderInfo) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public DataStore addDataStore(StoragePool sp, String uri, Map<String, String> params) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public DataStore getDataStore(StoragePool pool) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Map<HypervisorType, Map<String, DataStoreConfigurator>> getDataStoreConfigs() {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/provider/SwiftSecondaryStorageProvider.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/provider/SwiftSecondaryStorageProvider.java b/engine/storage/src/org/apache/cloudstack/storage/provider/SwiftSecondaryStorageProvider.java
index cfe0e48..c62b8b1 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/provider/SwiftSecondaryStorageProvider.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/provider/SwiftSecondaryStorageProvider.java
@@ -33,59 +33,59 @@ import com.cloud.storage.StoragePool;
 
 public class SwiftSecondaryStorageProvider implements StorageProvider {
 
-	public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	public String getName() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public boolean start() {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	public boolean stop() {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	public List<HypervisorType> supportedHypervisors() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public String getProviderName() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public List<StoreType> supportedStoreTypes() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public void configure(Map<String, String> storeProviderInfo) {
-		// TODO Auto-generated method stub
-
-	}
-
-	public DataStore addDataStore(StoragePool sp, String uri, Map<String, String> params) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public DataStore getDataStore(StoragePool pool) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public Map<HypervisorType, Map<String, DataStoreConfigurator>> getDataStoreConfigs() {
-		// TODO Auto-generated method stub
-		return null;
-	}
+    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public String getName() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public boolean start() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public boolean stop() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    public List<HypervisorType> supportedHypervisors() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getProviderName() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public List<StoreType> supportedStoreTypes() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public void configure(Map<String, String> storeProviderInfo) {
+        // TODO Auto-generated method stub
+
+    }
+
+    public DataStore addDataStore(StoragePool sp, String uri, Map<String, String> params) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public DataStore getDataStore(StoragePool pool) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Map<HypervisorType, Map<String, DataStoreConfigurator>> getDataStoreConfigs() {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/573d13dd/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotService.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotService.java b/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotService.java
index 6adab00..d13582c 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotService.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotService.java
@@ -19,6 +19,7 @@
 package org.apache.cloudstack.storage.snapshot;
 
 public interface SnapshotService {
-	long takeSnapshot(long volumeId);
-	boolean deleteSnapshot(long snapshotId);
+    long takeSnapshot(long volumeId);
+
+    boolean deleteSnapshot(long snapshotId);
 }


Mime
View raw message