incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahu...@apache.org
Subject [6/25] removed componentlocator and inject
Date Thu, 10 Jan 2013 22:47:20 GMT
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f40e7b75/core/src/com/cloud/storage/template/DownloadManagerImpl.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/storage/template/DownloadManagerImpl.java b/core/src/com/cloud/storage/template/DownloadManagerImpl.java
index f8b075d..d5ed71e 100755
--- a/core/src/com/cloud/storage/template/DownloadManagerImpl.java
+++ b/core/src/com/cloud/storage/template/DownloadManagerImpl.java
@@ -29,8 +29,8 @@ import java.security.NoSuchAlgorithmException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
-import java.util.Enumeration;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
@@ -43,7 +43,6 @@ import javax.naming.ConfigurationException;
 
 import org.apache.log4j.Logger;
 
-import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.storage.DownloadAnswer;
 import com.cloud.agent.api.storage.DownloadCommand;
 import com.cloud.agent.api.storage.DownloadCommand.Proxy;
@@ -60,10 +59,6 @@ import com.cloud.storage.template.Processor.FormatInfo;
 import com.cloud.storage.template.TemplateDownloader.DownloadCompleteCallback;
 import com.cloud.storage.template.TemplateDownloader.Status;
 import com.cloud.utils.NumbersUtil;
-import com.cloud.utils.component.Adapter;
-import com.cloud.utils.component.Adapters;
-import com.cloud.utils.component.ComponentLocator;
-import com.cloud.utils.component.LegacyComponentLocator.ComponentInfo;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.script.OutputInterpreter;
 import com.cloud.utils.script.Script;
@@ -72,7 +67,7 @@ import com.cloud.utils.script.Script;
 public class DownloadManagerImpl implements DownloadManager {
     private String _name;
     StorageLayer _storage;
-    Adapters<Processor> _processors;
+    Map<String, Processor> _processors;
 
     public class Completion implements DownloadCompleteCallback {
         private final String jobId;
@@ -94,14 +89,14 @@ public class DownloadManagerImpl implements DownloadManager {
         private final boolean hvm;
         private final ImageFormat format;
         private String tmpltPath;
-        private String description;
+        private final String description;
         private String checksum;
-        private Long accountId;
-        private String installPathPrefix;
+        private final Long accountId;
+        private final String installPathPrefix;
         private long templatesize;
         private long templatePhysicalSize;
-        private long id;
-		private ResourceType resourceType;
+        private final long id;
+        private final ResourceType resourceType;
 
         public DownloadJob(TemplateDownloader td, String jobId, long id, String tmpltName, ImageFormat format, boolean hvm, Long accountId, String descr, String cksum, String installPathPrefix, ResourceType resourceType) {
             super();
@@ -160,10 +155,10 @@ public class DownloadManagerImpl implements DownloadManager {
         }
 
         public ResourceType getResourceType() {
-			return resourceType;
-		}
+            return resourceType;
+        }
 
-		public void setTmpltPath(String tmpltPath) {
+        public void setTmpltPath(String tmpltPath) {
             this.tmpltPath = tmpltPath;
         }
 
@@ -205,9 +200,9 @@ public class DownloadManagerImpl implements DownloadManager {
         public long getTemplatePhysicalSize() {
             return templatePhysicalSize;
         }
-        
+
         public void setCheckSum(String checksum) {
-        	this.checksum = checksum;
+            this.checksum = checksum;
         }
     }
 
@@ -216,7 +211,7 @@ public class DownloadManagerImpl implements DownloadManager {
     private String _volumeDir;
     private String createTmpltScr;
     private String createVolScr;
-    private Adapters<Processor> processors;
+    private List<Processor> processors;
 
     private ExecutorService threadPool;
 
@@ -278,9 +273,9 @@ public class DownloadManagerImpl implements DownloadManager {
             break;
         }
     }
-    
+
     private String computeCheckSum(File f) {
-    	byte[] buffer = new byte[8192];
+        byte[] buffer = new byte[8192];
         int read = 0;
         MessageDigest digest;
         String checksum = null;        
@@ -296,16 +291,16 @@ public class DownloadManagerImpl implements DownloadManager {
             checksum = String.format("%032x",bigInt);
             return checksum;
         }catch(IOException e) {
-        	return null;
+            return null;
         }catch (NoSuchAlgorithmException e) {         
-        	return null;
+            return null;
         }
         finally {
             try {
-            	if(is != null)
-            		is.close();
+                if(is != null)
+                    is.close();
             } catch (IOException e) {
-            	return null;
+                return null;
             }                        
         }
     }
@@ -320,17 +315,17 @@ public class DownloadManagerImpl implements DownloadManager {
         TemplateDownloader td = dnld.getTemplateDownloader();
         String resourcePath = null;               
         ResourceType resourceType = dnld.getResourceType();
-       
+
         // once template path is set, remove the parent dir so that the template is installed with a relative path
         String finalResourcePath = "";
         if (resourceType == ResourceType.TEMPLATE){
-        	finalResourcePath += _templateDir + File.separator + dnld.getAccountId() + File.separator + dnld.getId() + File.separator;
-        	resourcePath = dnld.getInstallPathPrefix() + dnld.getAccountId() + File.separator + dnld.getId() + File.separator;// dnld.getTmpltName();
+            finalResourcePath += _templateDir + File.separator + dnld.getAccountId() + File.separator + dnld.getId() + File.separator;
+            resourcePath = dnld.getInstallPathPrefix() + dnld.getAccountId() + File.separator + dnld.getId() + File.separator;// dnld.getTmpltName();
         }else {
-        	finalResourcePath += _volumeDir + File.separator + dnld.getId() + File.separator;
-        	resourcePath = dnld.getInstallPathPrefix() + dnld.getId() + File.separator;// dnld.getTmpltName();
+            finalResourcePath += _volumeDir + File.separator + dnld.getId() + File.separator;
+            resourcePath = dnld.getInstallPathPrefix() + dnld.getId() + File.separator;// dnld.getTmpltName();
         }
-        
+
         _storage.mkdirs(resourcePath);
         dnld.setTmpltPath(finalResourcePath);
 
@@ -389,9 +384,9 @@ public class DownloadManagerImpl implements DownloadManager {
         // Set permissions for template/volume.properties
         String propertiesFile = resourcePath;
         if (resourceType == ResourceType.TEMPLATE){
-        	propertiesFile += "/template.properties";
+            propertiesFile += "/template.properties";
         }else{
-        	propertiesFile += "/volume.properties";
+            propertiesFile += "/volume.properties";
         }
         File templateProperties = new File(propertiesFile);
         _storage.setWorldReadableAndWriteable(templateProperties);
@@ -405,9 +400,9 @@ public class DownloadManagerImpl implements DownloadManager {
             return "Unable to download due to " + e.getMessage();
         }
 
-        Enumeration<Processor> en = _processors.enumeration();
-        while (en.hasMoreElements()) {
-            Processor processor = en.nextElement();
+        Iterator<Processor> en = _processors.values().iterator();
+        while (en.hasNext()) {
+            Processor processor = en.next();
 
             FormatInfo info = null;
             try {
@@ -423,7 +418,7 @@ public class DownloadManagerImpl implements DownloadManager {
                 break;
             }
         }
-        
+
         if (!loc.save()) {
             s_logger.warn("Cleaning up because we're unable to save the formats");
             loc.purge();
@@ -450,9 +445,9 @@ public class DownloadManagerImpl implements DownloadManager {
         String jobId = uuid.toString();
         String tmpDir = "";
         if(resourceType == ResourceType.TEMPLATE){
-        	tmpDir = installPathPrefix + File.separator + accountId + File.separator + id;
+            tmpDir = installPathPrefix + File.separator + accountId + File.separator + id;
         }else {
-        	tmpDir = installPathPrefix + File.separator + id;
+            tmpDir = installPathPrefix + File.separator + id;
         }
 
         try {
@@ -463,7 +458,7 @@ public class DownloadManagerImpl implements DownloadManager {
             }
             //	TO DO - define constant for volume properties.
             File file = ResourceType.TEMPLATE == resourceType ? _storage.getFile(tmpDir + File.separator + TemplateLocation.Filename) : 
-            	_storage.getFile(tmpDir + File.separator + "volume.properties");
+                _storage.getFile(tmpDir + File.separator + "volume.properties");
             if ( file.exists() ) {
                 file.delete();
             }
@@ -524,9 +519,9 @@ public class DownloadManagerImpl implements DownloadManager {
         }
         return 0;
     }
-    
+
     public String getDownloadCheckSum(String jobId) {
-    	DownloadJob dj = jobs.get(jobId);
+        DownloadJob dj = jobs.get(jobId);
         if (dj != null) {
             return dj.getChecksum();
         }
@@ -589,7 +584,7 @@ public class DownloadManagerImpl implements DownloadManager {
 
     @Override
     public DownloadAnswer handleDownloadCommand(SecondaryStorageResource resource, DownloadCommand cmd) {
-    	ResourceType resourceType = cmd.getResourceType();
+        ResourceType resourceType = cmd.getResourceType();
         if (cmd instanceof DownloadProgressCommand) {
             return handleDownloadProgressCmd( resource, (DownloadProgressCommand) cmd);
         }
@@ -604,9 +599,9 @@ public class DownloadManagerImpl implements DownloadManager {
 
         String installPathPrefix = null;
         if (ResourceType.TEMPLATE == resourceType){
-        	installPathPrefix = resource.getRootDir(cmd) + File.separator + _templateDir;
+            installPathPrefix = resource.getRootDir(cmd) + File.separator + _templateDir;
         }else {
-        	installPathPrefix = resource.getRootDir(cmd) + File.separator + _volumeDir;
+            installPathPrefix = resource.getRootDir(cmd) + File.separator + _volumeDir;
         }
 
         String user = null;
@@ -693,10 +688,10 @@ public class DownloadManagerImpl implements DownloadManager {
 
     }
 
-    
+
     private List<String> listVolumes(String rootdir) {
         List<String> result = new ArrayList<String>();
-        
+
         Script script = new Script(listVolScr, s_logger);
         script.add("-r", rootdir);
         ZfsPathParser zpp = new ZfsPathParser(rootdir);
@@ -705,12 +700,12 @@ public class DownloadManagerImpl implements DownloadManager {
         s_logger.info("found " + zpp.getPaths().size() + " volumes" + zpp.getPaths());
         return result;
     }
-    
-    
-    
+
+
+
     private List<String> listTemplates(String rootdir) {
         List<String> result = new ArrayList<String>();
-        
+
         Script script = new Script(listTmpltScr, s_logger);
         script.add("-r", rootdir);
         ZfsPathParser zpp = new ZfsPathParser(rootdir);
@@ -724,11 +719,11 @@ public class DownloadManagerImpl implements DownloadManager {
     public Map<String, TemplateInfo> gatherTemplateInfo(String rootDir) {
         Map<String, TemplateInfo> result = new HashMap<String, TemplateInfo>();
         String templateDir = rootDir + File.separator + _templateDir;
-        
+
         if (! _storage.exists(templateDir)) {
             _storage.mkdirs(templateDir);
         }
-        
+
         List<String> publicTmplts = listTemplates(templateDir);
         for (String tmplt : publicTmplts) {
             String path = tmplt.substring(0, tmplt.lastIndexOf(File.separator));
@@ -746,18 +741,18 @@ public class DownloadManagerImpl implements DownloadManager {
             }
 
             TemplateInfo tInfo = loc.getTemplateInfo();
-            
+
             if ((tInfo.size == tInfo.physicalSize) && (tInfo.installPath.endsWith(ImageFormat.OVA.getFileExtension()))) {
-            	try {
-            	    Processor processor = _processors.get("VMDK Processor");
-            	    VmdkProcessor vmdkProcessor = (VmdkProcessor)processor;
-            	    long vSize = vmdkProcessor.getTemplateVirtualSize(path, tInfo.installPath.substring(tInfo.installPath.lastIndexOf(File.separator) + 1));
-                	tInfo.size = vSize;
-                	loc.updateVirtualSize(vSize);
-                	loc.save();
-            	} catch (Exception e) {
-            		s_logger.error("Unable to get the virtual size of the template: " + tInfo.installPath + " due to " + e.getMessage());
-            	}
+                try {
+                    Processor processor = _processors.get("VMDK Processor");
+                    VmdkProcessor vmdkProcessor = (VmdkProcessor)processor;
+                    long vSize = vmdkProcessor.getTemplateVirtualSize(path, tInfo.installPath.substring(tInfo.installPath.lastIndexOf(File.separator) + 1));
+                    tInfo.size = vSize;
+                    loc.updateVirtualSize(vSize);
+                    loc.save();
+                } catch (Exception e) {
+                    s_logger.error("Unable to get the virtual size of the template: " + tInfo.installPath + " due to " + e.getMessage());
+                }
             }
 
             result.put(tInfo.templateName, tInfo);
@@ -777,52 +772,52 @@ public class DownloadManagerImpl implements DownloadManager {
         return result;
     }
 
-	@Override
-	public Map<Long, TemplateInfo> gatherVolumeInfo(String rootDir) {	
-	        Map<Long, TemplateInfo> result = new HashMap<Long, TemplateInfo>();
-	        String volumeDir = rootDir + File.separator + _volumeDir;
-	        
-	        if (! _storage.exists(volumeDir)) {
-	            _storage.mkdirs(volumeDir);
-	        }
-	        
-	        List<String> vols = listVolumes(volumeDir);
-	        for (String vol : vols) {
-	            String path = vol.substring(0, vol.lastIndexOf(File.separator));
-	            TemplateLocation loc = new TemplateLocation(_storage, path);
-	            try {
-	                if (!loc.load()) {
-	                    s_logger.warn("Post download installation was not completed for " + path);
-	                    //loc.purge();
-	                    _storage.cleanup(path, volumeDir);
-	                    continue;
-	                }
-	            } catch (IOException e) {
-	                s_logger.warn("Unable to load volume location " + path, e);
-	                continue;
-	            }
-
-	            TemplateInfo vInfo = loc.getTemplateInfo();
-	            
-	            if ((vInfo.size == vInfo.physicalSize) && (vInfo.installPath.endsWith(ImageFormat.OVA.getFileExtension()))) {
-	            	try {
-	            	    Processor processor = _processors.get("VMDK Processor");
-	            	    VmdkProcessor vmdkProcessor = (VmdkProcessor)processor;
-	            	    long vSize = vmdkProcessor.getTemplateVirtualSize(path, vInfo.installPath.substring(vInfo.installPath.lastIndexOf(File.separator) + 1));
-	                	vInfo.size = vSize;
-	                	loc.updateVirtualSize(vSize);
-	                	loc.save();
-	            	} catch (Exception e) {
-	            		s_logger.error("Unable to get the virtual size of the volume: " + vInfo.installPath + " due to " + e.getMessage());
-	            	}
-	            }
-
-	            result.put(vInfo.getId(), vInfo);
-	            s_logger.debug("Added volume name: " + vInfo.templateName + ", path: " + vol);
-	        }
-	        return result;
-	    }
-	
+    @Override
+    public Map<Long, TemplateInfo> gatherVolumeInfo(String rootDir) {	
+        Map<Long, TemplateInfo> result = new HashMap<Long, TemplateInfo>();
+        String volumeDir = rootDir + File.separator + _volumeDir;
+
+        if (! _storage.exists(volumeDir)) {
+            _storage.mkdirs(volumeDir);
+        }
+
+        List<String> vols = listVolumes(volumeDir);
+        for (String vol : vols) {
+            String path = vol.substring(0, vol.lastIndexOf(File.separator));
+            TemplateLocation loc = new TemplateLocation(_storage, path);
+            try {
+                if (!loc.load()) {
+                    s_logger.warn("Post download installation was not completed for " + path);
+                    //loc.purge();
+                    _storage.cleanup(path, volumeDir);
+                    continue;
+                }
+            } catch (IOException e) {
+                s_logger.warn("Unable to load volume location " + path, e);
+                continue;
+            }
+
+            TemplateInfo vInfo = loc.getTemplateInfo();
+
+            if ((vInfo.size == vInfo.physicalSize) && (vInfo.installPath.endsWith(ImageFormat.OVA.getFileExtension()))) {
+                try {
+                    Processor processor = _processors.get("VMDK Processor");
+                    VmdkProcessor vmdkProcessor = (VmdkProcessor)processor;
+                    long vSize = vmdkProcessor.getTemplateVirtualSize(path, vInfo.installPath.substring(vInfo.installPath.lastIndexOf(File.separator) + 1));
+                    vInfo.size = vSize;
+                    loc.updateVirtualSize(vSize);
+                    loc.save();
+                } catch (Exception e) {
+                    s_logger.error("Unable to get the virtual size of the volume: " + vInfo.installPath + " due to " + e.getMessage());
+                }
+            }
+
+            result.put(vInfo.getId(), vInfo);
+            s_logger.debug("Added volume name: " + vInfo.templateName + ", path: " + vol);
+        }
+        return result;
+    }
+
     private int deleteDownloadDirectories(File downloadPath, int deleted) {
         try {
             if (downloadPath.exists()) {
@@ -881,7 +876,7 @@ public class DownloadManagerImpl implements DownloadManager {
 
         String value = null;
 
-        _storage = (StorageLayer) params.get(StorageLayer.InstanceConfigKey);
+        _storage = (StorageLayer)params.get(StorageLayer.InstanceConfigKey);
         if (_storage == null) {
             value = (String) params.get(StorageLayer.ClassConfigKey);
             if (value == null) {
@@ -891,10 +886,14 @@ public class DownloadManagerImpl implements DownloadManager {
             Class<StorageLayer> clazz;
             try {
                 clazz = (Class<StorageLayer>) Class.forName(value);
+                _storage = clazz.newInstance();
             } catch (ClassNotFoundException e) {
                 throw new ConfigurationException("Unable to instantiate " + value);
+            } catch (InstantiationException e) {
+                throw new ConfigurationException("Unable to instantiate " + value);
+            } catch (IllegalAccessException e) {
+                throw new ConfigurationException("Unable to instantiate " + value);
             }
-            _storage = ComponentLocator.inject(clazz);
         }
         String useSsl = (String)params.get("sslcopy");
         if (useSsl != null) {
@@ -943,29 +942,27 @@ public class DownloadManagerImpl implements DownloadManager {
         }
         s_logger.info("createvolume.sh found in " + createVolScr);
 
-        List<ComponentInfo<Adapter>> processors = new ArrayList<ComponentInfo<Adapter>>();
+        _processors = new HashMap<String, Processor>();
 
         Processor processor = new VhdProcessor();
         processor.configure("VHD Processor", params);
-        processors.add(new ComponentInfo<Adapter>("VHD Processor", VhdProcessor.class, processor));
+        _processors.put("VHD Processor", processor);
 
         processor = new IsoProcessor();
         processor.configure("ISO Processor", params);
-        processors.add(new ComponentInfo<Adapter>("ISO Processor", IsoProcessor.class, processor));
+        _processors.put("ISO Processor", processor);
 
         processor = new QCOW2Processor();
         processor.configure("QCOW2 Processor", params);
-        processors.add(new ComponentInfo<Adapter>("QCOW2 Processor", QCOW2Processor.class, processor));
+        _processors.put("QCOW2 Processor", processor);
 
         processor = new VmdkProcessor();
         processor.configure("VMDK Processor", params);
-        processors.add(new ComponentInfo<Adapter>("VMDK Processor", VmdkProcessor.class, processor));
+        _processors.put("VMDK Processor", processor);
 
         processor = new RawImageProcessor();
         processor.configure("Raw Image Processor", params);
-        processors.add(new ComponentInfo<Adapter>("Raw Image Processor", RawImageProcessor.class, processor));
-        
-        _processors = new Adapters<Processor>("processors", processors);
+        _processors.put("Raw Image Processor", processor);
 
         _templateDir = (String) params.get("public.templates.root.dir");
         if (_templateDir == null) {
@@ -1047,5 +1044,5 @@ public class DownloadManagerImpl implements DownloadManager {
             return;
         }
     }
-	
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f40e7b75/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/ClusterDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/ClusterDaoImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/ClusterDaoImpl.java
index bd4a5ae..f33c673 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/ClusterDaoImpl.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/ClusterDaoImpl.java
@@ -32,109 +32,107 @@ import org.apache.cloudstack.engine.datacenter.entity.api.db.HostPodVO;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
-
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.org.Grouping;
-import com.cloud.utils.component.ComponentLocator;
 import com.cloud.utils.db.GenericDaoBase;
 import com.cloud.utils.db.GenericSearchBuilder;
 import com.cloud.utils.db.JoinBuilder;
 import com.cloud.utils.db.SearchBuilder;
 import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.db.UpdateBuilder;
 import com.cloud.utils.db.SearchCriteria.Func;
 import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.Transaction;
+import com.cloud.utils.db.UpdateBuilder;
 import com.cloud.utils.exception.CloudRuntimeException;
 
 @Component(value="EngineClusterDao")
 @Local(value=ClusterDao.class)
 public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements ClusterDao {
-	private static final Logger s_logger = Logger.getLogger(ClusterDaoImpl.class);
-	
+    private static final Logger s_logger = Logger.getLogger(ClusterDaoImpl.class);
+
     protected final SearchBuilder<ClusterVO> PodSearch;
     protected final SearchBuilder<ClusterVO> HyTypeWithoutGuidSearch;
     protected final SearchBuilder<ClusterVO> AvailHyperSearch;
     protected final SearchBuilder<ClusterVO> ZoneSearch;
     protected final SearchBuilder<ClusterVO> ZoneHyTypeSearch;
     protected SearchBuilder<ClusterVO> StateChangeSearch;
-	protected SearchBuilder<ClusterVO> UUIDSearch;
-	
+    protected SearchBuilder<ClusterVO> UUIDSearch;
+
     private static final String GET_POD_CLUSTER_MAP_PREFIX = "SELECT pod_id, id FROM cloud.cluster WHERE cluster.id IN( ";
     private static final String GET_POD_CLUSTER_MAP_SUFFIX = " )";
-    
+
     @Inject protected HostPodDao _hostPodDao;
-    
+
     protected ClusterDaoImpl() {
         super();
-        
+
         HyTypeWithoutGuidSearch = createSearchBuilder();
         HyTypeWithoutGuidSearch.and("hypervisorType", HyTypeWithoutGuidSearch.entity().getHypervisorType(), SearchCriteria.Op.EQ);
         HyTypeWithoutGuidSearch.and("guid", HyTypeWithoutGuidSearch.entity().getGuid(), SearchCriteria.Op.NULL);
         HyTypeWithoutGuidSearch.done();
-        
+
         ZoneHyTypeSearch = createSearchBuilder();
         ZoneHyTypeSearch.and("hypervisorType", ZoneHyTypeSearch.entity().getHypervisorType(), SearchCriteria.Op.EQ);
         ZoneHyTypeSearch.and("dataCenterId", ZoneHyTypeSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
         ZoneHyTypeSearch.done();
-        
+
         PodSearch = createSearchBuilder();
         PodSearch.and("pod", PodSearch.entity().getPodId(), SearchCriteria.Op.EQ);
         PodSearch.and("name", PodSearch.entity().getName(), SearchCriteria.Op.EQ);
         PodSearch.done();
-        
+
         ZoneSearch = createSearchBuilder();
         ZoneSearch.and("dataCenterId", ZoneSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
         ZoneSearch.groupBy(ZoneSearch.entity().getHypervisorType());
         ZoneSearch.done();
-        
+
         AvailHyperSearch = createSearchBuilder();
         AvailHyperSearch.and("zoneId", AvailHyperSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
         AvailHyperSearch.select(null, Func.DISTINCT, AvailHyperSearch.entity().getHypervisorType());
         AvailHyperSearch.done();
-        
-	    UUIDSearch = createSearchBuilder();
-	    UUIDSearch.and("uuid", UUIDSearch.entity().getUuid(), SearchCriteria.Op.EQ);
-	    UUIDSearch.done();
-	    
+
+        UUIDSearch = createSearchBuilder();
+        UUIDSearch.and("uuid", UUIDSearch.entity().getUuid(), SearchCriteria.Op.EQ);
+        UUIDSearch.done();
+
         StateChangeSearch = createSearchBuilder();
         StateChangeSearch.and("id", StateChangeSearch.entity().getId(), SearchCriteria.Op.EQ);
         StateChangeSearch.and("state", StateChangeSearch.entity().getState(), SearchCriteria.Op.EQ);
         StateChangeSearch.done();	    
     }
-    
+
     @Override
     public List<ClusterVO> listByZoneId(long zoneId) {
         SearchCriteria<ClusterVO> sc = ZoneSearch.create();
         sc.setParameters("dataCenterId", zoneId);        
         return listBy(sc);
     }
-    
+
     @Override
     public List<ClusterVO> listByPodId(long podId) {
         SearchCriteria<ClusterVO> sc = PodSearch.create();
         sc.setParameters("pod", podId);
-        
+
         return listBy(sc);
     }
-    
+
     @Override
     public ClusterVO findBy(String name, long podId) {
         SearchCriteria<ClusterVO> sc = PodSearch.create();
         sc.setParameters("pod", podId);
         sc.setParameters("name", name);
-        
+
         return findOneBy(sc);
     }
-    
+
     @Override
     public List<ClusterVO> listByHyTypeWithoutGuid(String hyType) {
         SearchCriteria<ClusterVO> sc = HyTypeWithoutGuidSearch.create();
         sc.setParameters("hypervisorType", hyType);
-        
+
         return listBy(sc);
     }
-    
+
     @Override
     public List<ClusterVO> listByDcHyType(long dcId, String hyType) {
         SearchCriteria<ClusterVO> sc = ZoneHyTypeSearch.create();
@@ -142,7 +140,7 @@ public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements C
         sc.setParameters("hypervisorType", hyType);
         return listBy(sc);
     }
-    
+
     @Override
     public List<HypervisorType> getAvailableHypervisorInZone(Long zoneId) {
         SearchCriteria<ClusterVO> sc = AvailHyperSearch.create();
@@ -154,13 +152,13 @@ public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements C
         for (ClusterVO cluster : clusters) {
             hypers.add(cluster.getHypervisorType());
         }
-        
+
         return hypers;
     }
-    
+
     @Override
     public Map<Long, List<Long>> getPodClusterIdMap(List<Long> clusterIds){
-    	Transaction txn = Transaction.currentTxn();
+        Transaction txn = Transaction.currentTxn();
         PreparedStatement pstmt = null;
         Map<Long, List<Long>> result = new HashMap<Long, List<Long>>();
 
@@ -173,20 +171,20 @@ public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements C
                 sql.delete(sql.length()-1, sql.length());
                 sql.append(GET_POD_CLUSTER_MAP_SUFFIX);
             }
-            
+
             pstmt = txn.prepareAutoCloseStatement(sql.toString());
             ResultSet rs = pstmt.executeQuery();
             while (rs.next()) {
-            	Long podId = rs.getLong(1);
-            	Long clusterIdInPod  = rs.getLong(2);
+                Long podId = rs.getLong(1);
+                Long clusterIdInPod  = rs.getLong(2);
                 if(result.containsKey(podId)){
-                   	List<Long> clusterList = result.get(podId);
-                	clusterList.add(clusterIdInPod);
-                	result.put(podId, clusterList);
+                    List<Long> clusterList = result.get(podId);
+                    clusterList.add(clusterIdInPod);
+                    result.put(podId, clusterList);
                 }else{
-                	List<Long> clusterList = new ArrayList<Long>();
-                	clusterList.add(clusterIdInPod);
-                	result.put(podId, clusterList);
+                    List<Long> clusterList = new ArrayList<Long>();
+                    clusterList.add(clusterIdInPod);
+                    result.put(podId, clusterList);
                 }
             }
             return result;
@@ -196,49 +194,49 @@ public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements C
             throw new CloudRuntimeException("Caught: " + GET_POD_CLUSTER_MAP_PREFIX, e);
         }
     }
-    
+
     @Override
     public List<Long> listDisabledClusters(long zoneId, Long podId) {
-    	GenericSearchBuilder<ClusterVO, Long> clusterIdSearch = createSearchBuilder(Long.class);
-    	clusterIdSearch.selectField(clusterIdSearch.entity().getId());
-    	clusterIdSearch.and("dataCenterId", clusterIdSearch.entity().getDataCenterId(), Op.EQ);
-    	if(podId != null){
-    		clusterIdSearch.and("podId", clusterIdSearch.entity().getPodId(), Op.EQ);
-    	}
-    	clusterIdSearch.and("allocationState", clusterIdSearch.entity().getAllocationState(), Op.EQ);
-    	clusterIdSearch.done();
-
-    	
-    	SearchCriteria<Long> sc = clusterIdSearch.create();
+        GenericSearchBuilder<ClusterVO, Long> clusterIdSearch = createSearchBuilder(Long.class);
+        clusterIdSearch.selectField(clusterIdSearch.entity().getId());
+        clusterIdSearch.and("dataCenterId", clusterIdSearch.entity().getDataCenterId(), Op.EQ);
+        if(podId != null){
+            clusterIdSearch.and("podId", clusterIdSearch.entity().getPodId(), Op.EQ);
+        }
+        clusterIdSearch.and("allocationState", clusterIdSearch.entity().getAllocationState(), Op.EQ);
+        clusterIdSearch.done();
+
+
+        SearchCriteria<Long> sc = clusterIdSearch.create();
         sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, zoneId);
         if (podId != null) {
-	        sc.addAnd("podId", SearchCriteria.Op.EQ, podId);
-	    }
+            sc.addAnd("podId", SearchCriteria.Op.EQ, podId);
+        }
         sc.addAnd("allocationState", SearchCriteria.Op.EQ, Grouping.AllocationState.Disabled);
         return customSearch(sc, null);
     }
 
     @Override
     public List<Long> listClustersWithDisabledPods(long zoneId) {
-    	
-    	GenericSearchBuilder<HostPodVO, Long> disabledPodIdSearch = _hostPodDao.createSearchBuilder(Long.class);
-    	disabledPodIdSearch.selectField(disabledPodIdSearch.entity().getId());
-    	disabledPodIdSearch.and("dataCenterId", disabledPodIdSearch.entity().getDataCenterId(), Op.EQ);
-    	disabledPodIdSearch.and("allocationState", disabledPodIdSearch.entity().getAllocationState(), Op.EQ);
-
-    	GenericSearchBuilder<ClusterVO, Long> clusterIdSearch = createSearchBuilder(Long.class);
-    	clusterIdSearch.selectField(clusterIdSearch.entity().getId());
-    	clusterIdSearch.join("disabledPodIdSearch", disabledPodIdSearch, clusterIdSearch.entity().getPodId(), disabledPodIdSearch.entity().getId(), JoinBuilder.JoinType.INNER);
-    	clusterIdSearch.done();
-
-    	
-    	SearchCriteria<Long> sc = clusterIdSearch.create();
+
+        GenericSearchBuilder<HostPodVO, Long> disabledPodIdSearch = _hostPodDao.createSearchBuilder(Long.class);
+        disabledPodIdSearch.selectField(disabledPodIdSearch.entity().getId());
+        disabledPodIdSearch.and("dataCenterId", disabledPodIdSearch.entity().getDataCenterId(), Op.EQ);
+        disabledPodIdSearch.and("allocationState", disabledPodIdSearch.entity().getAllocationState(), Op.EQ);
+
+        GenericSearchBuilder<ClusterVO, Long> clusterIdSearch = createSearchBuilder(Long.class);
+        clusterIdSearch.selectField(clusterIdSearch.entity().getId());
+        clusterIdSearch.join("disabledPodIdSearch", disabledPodIdSearch, clusterIdSearch.entity().getPodId(), disabledPodIdSearch.entity().getId(), JoinBuilder.JoinType.INNER);
+        clusterIdSearch.done();
+
+
+        SearchCriteria<Long> sc = clusterIdSearch.create();
         sc.setJoinParameters("disabledPodIdSearch", "dataCenterId", zoneId);
         sc.setJoinParameters("disabledPodIdSearch", "allocationState", Grouping.AllocationState.Disabled);
-        
+
         return customSearch(sc, null);
     }
-    
+
     @Override
     public boolean remove(Long id) {
         Transaction txn = Transaction.currentTxn();
@@ -246,30 +244,30 @@ public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements C
         ClusterVO cluster = createForUpdate();
         cluster.setName(null);
         cluster.setGuid(null);
-        
+
         update(id, cluster);
 
         boolean result = super.remove(id);
         txn.commit();
         return result;
     }
-    
-    
-	@Override
-	public ClusterVO findByUUID(String uuid) {
-    	SearchCriteria<ClusterVO> sc = UUIDSearch.create();
-    	sc.setParameters("uuid", uuid);
+
+
+    @Override
+    public ClusterVO findByUUID(String uuid) {
+        SearchCriteria<ClusterVO> sc = UUIDSearch.create();
+        sc.setParameters("uuid", uuid);
         return findOneBy(sc);
-	}
+    }
+
+    @Override
+    public boolean updateState(State currentState, Event event, State nextState, DataCenterResourceEntity clusterEntity, Object data) {
+
+        ClusterVO vo = findById(clusterEntity.getId());
 
-	@Override
-	public boolean updateState(State currentState, Event event, State nextState, DataCenterResourceEntity clusterEntity, Object data) {
-		
-		ClusterVO vo = findById(clusterEntity.getId());
-		
-		Date oldUpdatedTime = vo.getLastUpdated();
+        Date oldUpdatedTime = vo.getLastUpdated();
 
-		SearchCriteria<ClusterVO> sc = StateChangeSearch.create();
+        SearchCriteria<ClusterVO> sc = StateChangeSearch.create();
         sc.setParameters("id", vo.getId());
         sc.setParameters("state", currentState);
 
@@ -277,14 +275,14 @@ public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements C
         builder.set(vo, "state", nextState);
         builder.set(vo, "lastUpdated", new Date());
 
-        int rows = update((ClusterVO) vo, sc);
-        
+        int rows = update(vo, sc);
+
         if (rows == 0 && s_logger.isDebugEnabled()) {
-        	ClusterVO dbCluster = findByIdIncludingRemoved(vo.getId());
+            ClusterVO dbCluster = findByIdIncludingRemoved(vo.getId());
             if (dbCluster != null) {
                 StringBuilder str = new StringBuilder("Unable to update ").append(vo.toString());
                 str.append(": DB Data={id=").append(dbCluster.getId()).append("; state=").append(dbCluster.getState()).append(";updatedTime=")
-                        .append(dbCluster.getLastUpdated());
+                .append(dbCluster.getLastUpdated());
                 str.append(": New Data={id=").append(vo.getId()).append("; state=").append(nextState).append("; event=").append(event).append("; updatedTime=").append(vo.getLastUpdated());
                 str.append(": stale Data={id=").append(vo.getId()).append("; state=").append(currentState).append("; event=").append(event).append("; updatedTime=").append(oldUpdatedTime);
             } else {
@@ -292,7 +290,7 @@ public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements C
             }
         }
         return rows > 0;
-		
-	}
-    
+
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f40e7b75/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/DataCenterDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/DataCenterDaoImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/DataCenterDaoImpl.java
index 61a4bb3..3a0d2c8 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/DataCenterDaoImpl.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/DataCenterDaoImpl.java
@@ -25,15 +25,12 @@ import javax.persistence.TableGenerator;
 import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity;
 import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State;
 import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State.Event;
-import org.apache.cloudstack.engine.datacenter.entity.api.ZoneEntity;
 import org.apache.cloudstack.engine.datacenter.entity.api.db.DataCenterVO;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
 import com.cloud.org.Grouping;
 import com.cloud.utils.NumbersUtil;
-import com.cloud.utils.Pair;
-import com.cloud.utils.component.ComponentLocator;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.GenericDaoBase;
 import com.cloud.utils.db.SearchBuilder;
@@ -63,47 +60,47 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
     protected SearchBuilder<DataCenterVO> TokenSearch;
     protected SearchBuilder<DataCenterVO> StateChangeSearch;
     protected SearchBuilder<DataCenterVO> UUIDSearch;
-    
+
     protected long _prefix;
     protected Random _rand = new Random(System.currentTimeMillis());
     protected TableGenerator _tgMacAddress;
-    
+
     @Inject protected DcDetailsDao _detailsDao;
 
 
     @Override
     public DataCenterVO findByName(String name) {
-    	SearchCriteria<DataCenterVO> sc = NameSearch.create();
-    	sc.setParameters("name", name);
+        SearchCriteria<DataCenterVO> sc = NameSearch.create();
+        sc.setParameters("name", name);
         return findOneBy(sc);
     }
 
     @Override
     public DataCenterVO findByUUID(String uuid) {
-    	SearchCriteria<DataCenterVO> sc = UUIDSearch.create();
-    	sc.setParameters("uuid", uuid);
+        SearchCriteria<DataCenterVO> sc = UUIDSearch.create();
+        sc.setParameters("uuid", uuid);
         return findOneBy(sc);
     }
-    
+
     @Override
     public DataCenterVO findByToken(String zoneToken){
-    	SearchCriteria<DataCenterVO> sc = TokenSearch.create();
-    	sc.setParameters("zoneToken", zoneToken);
+        SearchCriteria<DataCenterVO> sc = TokenSearch.create();
+        sc.setParameters("zoneToken", zoneToken);
         return findOneBy(sc);
     }
-    
+
     @Override
     public List<DataCenterVO> findZonesByDomainId(Long domainId){
-    	SearchCriteria<DataCenterVO> sc = ListZonesByDomainIdSearch.create();
-    	sc.setParameters("domainId", domainId);
+        SearchCriteria<DataCenterVO> sc = ListZonesByDomainIdSearch.create();
+        sc.setParameters("domainId", domainId);
         return listBy(sc);    	
     }
-    
+
     @Override
     public List<DataCenterVO> findZonesByDomainId(Long domainId, String keyword){
-    	SearchCriteria<DataCenterVO> sc = ListZonesByDomainIdSearch.create();
-    	sc.setParameters("domainId", domainId);
-    	if (keyword != null) {
+        SearchCriteria<DataCenterVO> sc = ListZonesByDomainIdSearch.create();
+        sc.setParameters("domainId", domainId);
+        if (keyword != null) {
             SearchCriteria<DataCenterVO> ssc = createSearchCriteria();
             ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
             ssc.addOr("description", SearchCriteria.Op.LIKE, "%" + keyword + "%");
@@ -111,12 +108,12 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
         }
         return listBy(sc);    	
     }
-    
+
     @Override
     public List<DataCenterVO> findChildZones(Object[] ids, String keyword){
-    	SearchCriteria<DataCenterVO> sc = ChildZonesSearch.create();
-    	sc.setParameters("domainid", ids);
-    	if (keyword != null) {
+        SearchCriteria<DataCenterVO> sc = ChildZonesSearch.create();
+        sc.setParameters("domainid", ids);
+        if (keyword != null) {
             SearchCriteria<DataCenterVO> ssc = createSearchCriteria();
             ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
             ssc.addOr("description", SearchCriteria.Op.LIKE, "%" + keyword + "%");
@@ -124,28 +121,28 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
         }
         return listBy(sc);  
     }
-    
+
     @Override
     public List<DataCenterVO> listPublicZones(String keyword){
-    	SearchCriteria<DataCenterVO> sc = PublicZonesSearch.create();
-    	if (keyword != null) {
+        SearchCriteria<DataCenterVO> sc = PublicZonesSearch.create();
+        if (keyword != null) {
             SearchCriteria<DataCenterVO> ssc = createSearchCriteria();
             ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
             ssc.addOr("description", SearchCriteria.Op.LIKE, "%" + keyword + "%");
             sc.addAnd("name", SearchCriteria.Op.SC, ssc);
         }
-    	//sc.setParameters("domainId", domainId);
+        //sc.setParameters("domainId", domainId);
         return listBy(sc);    	    	
     }
-    
+
     @Override
     public List<DataCenterVO> findByKeyword(String keyword){
-    	SearchCriteria<DataCenterVO> ssc = createSearchCriteria();
-    	ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
-    	ssc.addOr("description", SearchCriteria.Op.LIKE, "%" + keyword + "%");
+        SearchCriteria<DataCenterVO> ssc = createSearchCriteria();
+        ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
+        ssc.addOr("description", SearchCriteria.Op.LIKE, "%" + keyword + "%");
         return listBy(ssc);
     }
-    
+
 
     @Override
     public String[] getNextAvailableMacAddressPair(long id) {
@@ -155,7 +152,7 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
     @Override
     public String[] getNextAvailableMacAddressPair(long id, long mask) {
         SequenceFetcher fetch = SequenceFetcher.getInstance();
-        
+
         long seq = fetch.getNextSequence(Long.class, _tgMacAddress, id);
         seq = seq | _prefix | ((id & 0x7f) << 32);
         seq |= mask;
@@ -172,49 +169,49 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
         if (!super.configure(name, params)) {
             return false;
         }
-        
+
         String value = (String)params.get("mac.address.prefix");
         _prefix = (long)NumbersUtil.parseInt(value, 06) << 40;
 
         return true;
     }
-    
+
     protected DataCenterDaoImpl() {
         super();
         NameSearch = createSearchBuilder();
         NameSearch.and("name", NameSearch.entity().getName(), SearchCriteria.Op.EQ);
         NameSearch.done();
-        
+
         ListZonesByDomainIdSearch = createSearchBuilder();
         ListZonesByDomainIdSearch.and("domainId", ListZonesByDomainIdSearch.entity().getDomainId(), SearchCriteria.Op.EQ);
         ListZonesByDomainIdSearch.done();
-        
+
         PublicZonesSearch = createSearchBuilder();
         PublicZonesSearch.and("domainId", PublicZonesSearch.entity().getDomainId(), SearchCriteria.Op.NULL);
         PublicZonesSearch.done();        
-        
+
         ChildZonesSearch = createSearchBuilder();
         ChildZonesSearch.and("domainid", ChildZonesSearch.entity().getDomainId(), SearchCriteria.Op.IN);
         ChildZonesSearch.done();
-        
+
         DisabledZonesSearch = createSearchBuilder();
         DisabledZonesSearch.and("allocationState", DisabledZonesSearch.entity().getAllocationState(), SearchCriteria.Op.EQ);
         DisabledZonesSearch.done();
-        
+
         TokenSearch = createSearchBuilder();
         TokenSearch.and("zoneToken", TokenSearch.entity().getZoneToken(), SearchCriteria.Op.EQ);
         TokenSearch.done();
-        
+
         StateChangeSearch = createSearchBuilder();
         StateChangeSearch.and("id", StateChangeSearch.entity().getId(), SearchCriteria.Op.EQ);
         StateChangeSearch.and("state", StateChangeSearch.entity().getState(), SearchCriteria.Op.EQ);
         StateChangeSearch.done();
-        
+
         UUIDSearch = createSearchBuilder();
         UUIDSearch.and("uuid", UUIDSearch.entity().getUuid(), SearchCriteria.Op.EQ);
         UUIDSearch.done();
 
-        
+
         _tgMacAddress = _tgs.get("macAddress");
         assert _tgMacAddress != null : "Couldn't get mac address table generator";
     }
@@ -231,7 +228,7 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
         txn.commit();
         return persisted;
     }
-    
+
     @Override
     public void loadDetails(DataCenterVO zone) {
         Map<String, String> details =_detailsDao.findDetails(zone.getId());
@@ -246,25 +243,25 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
         }
         _detailsDao.persist(zone.getId(), details);
     }
-    
+
     @Override
     public List<DataCenterVO> listDisabledZones(){
-    	SearchCriteria<DataCenterVO> sc = DisabledZonesSearch.create();
-    	sc.setParameters("allocationState", Grouping.AllocationState.Disabled);
-    	
-    	List<DataCenterVO> dcs =  listBy(sc);
-    	
-    	return dcs;
+        SearchCriteria<DataCenterVO> sc = DisabledZonesSearch.create();
+        sc.setParameters("allocationState", Grouping.AllocationState.Disabled);
+
+        List<DataCenterVO> dcs =  listBy(sc);
+
+        return dcs;
     }
-    
+
     @Override
     public List<DataCenterVO> listEnabledZones(){
-    	SearchCriteria<DataCenterVO> sc = DisabledZonesSearch.create();
-    	sc.setParameters("allocationState", Grouping.AllocationState.Enabled);
-    	
-    	List<DataCenterVO> dcs =  listBy(sc);
-    	
-    	return dcs;
+        SearchCriteria<DataCenterVO> sc = DisabledZonesSearch.create();
+        sc.setParameters("allocationState", Grouping.AllocationState.Enabled);
+
+        List<DataCenterVO> dcs =  listBy(sc);
+
+        return dcs;
     }
 
     @Override
@@ -277,36 +274,36 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
                     Long dcId = Long.parseLong(tokenOrIdOrName);
                     return findById(dcId);
                 } catch (NumberFormatException nfe) {
-                    
+
                 }
             }
         }
         return result;
     }
-    
+
     @Override
     public boolean remove(Long id) {
         Transaction txn = Transaction.currentTxn();
         txn.start();
         DataCenterVO zone = createForUpdate();
         zone.setName(null);
-        
+
         update(id, zone);
 
         boolean result = super.remove(id);
         txn.commit();
         return result;
     }
-    
 
-	@Override
-	public boolean updateState(State currentState, Event event, State nextState, DataCenterResourceEntity zoneEntity, Object data) {
-		
-		DataCenterVO vo = findById(zoneEntity.getId());
-		
-		Date oldUpdatedTime = vo.getLastUpdated();
 
-		SearchCriteria<DataCenterVO> sc = StateChangeSearch.create();
+    @Override
+    public boolean updateState(State currentState, Event event, State nextState, DataCenterResourceEntity zoneEntity, Object data) {
+
+        DataCenterVO vo = findById(zoneEntity.getId());
+
+        Date oldUpdatedTime = vo.getLastUpdated();
+
+        SearchCriteria<DataCenterVO> sc = StateChangeSearch.create();
         sc.setParameters("id", vo.getId());
         sc.setParameters("state", currentState);
 
@@ -314,14 +311,14 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
         builder.set(vo, "state", nextState);
         builder.set(vo, "lastUpdated", new Date());
 
-        int rows = update((DataCenterVO) vo, sc);
-        
+        int rows = update(vo, sc);
+
         if (rows == 0 && s_logger.isDebugEnabled()) {
-        	DataCenterVO dbDC = findByIdIncludingRemoved(vo.getId());
+            DataCenterVO dbDC = findByIdIncludingRemoved(vo.getId());
             if (dbDC != null) {
                 StringBuilder str = new StringBuilder("Unable to update ").append(vo.toString());
                 str.append(": DB Data={id=").append(dbDC.getId()).append("; state=").append(dbDC.getState()).append(";updatedTime=")
-                        .append(dbDC.getLastUpdated());
+                .append(dbDC.getLastUpdated());
                 str.append(": New Data={id=").append(vo.getId()).append("; state=").append(nextState).append("; event=").append(event).append("; updatedTime=").append(vo.getLastUpdated());
                 str.append(": stale Data={id=").append(vo.getId()).append("; state=").append(currentState).append("; event=").append(event).append("; updatedTime=").append(oldUpdatedTime);
             } else {
@@ -329,8 +326,8 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
             }
         }
         return rows > 0;
-		
-	}
-    
-    
+
+    }
+
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f40e7b75/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/HostDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/HostDaoImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/HostDaoImpl.java
index 41e6785..f33bc21 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/HostDaoImpl.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/HostDaoImpl.java
@@ -31,8 +31,6 @@ import javax.persistence.TableGenerator;
 
 import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity;
 import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State;
-import org.apache.cloudstack.engine.datacenter.entity.api.db.ClusterVO;
-import org.apache.cloudstack.engine.datacenter.entity.api.db.DataCenterVO;
 import org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
@@ -40,21 +38,17 @@ import org.springframework.stereotype.Component;
 import com.cloud.host.Host;
 import com.cloud.host.Host.Type;
 import com.cloud.host.HostTagVO;
-
 import com.cloud.host.Status;
-import com.cloud.host.Status.Event;
 import com.cloud.info.RunningHostCountInfo;
 import com.cloud.org.Managed;
 import com.cloud.resource.ResourceState;
 import com.cloud.utils.DateUtil;
-import com.cloud.utils.component.ComponentLocator;
 import com.cloud.utils.db.Attribute;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.Filter;
 import com.cloud.utils.db.GenericDaoBase;
 import com.cloud.utils.db.GenericSearchBuilder;
 import com.cloud.utils.db.JoinBuilder;
-import com.cloud.utils.db.JoinBuilder.JoinType;
 import com.cloud.utils.db.SearchBuilder;
 import com.cloud.utils.db.SearchCriteria;
 import com.cloud.utils.db.SearchCriteria.Func;
@@ -104,7 +98,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
     protected final SearchBuilder<HostVO> ManagedRoutingServersSearch;
     protected final SearchBuilder<HostVO> SecondaryStorageVMSearch;
     protected SearchBuilder<HostVO> StateChangeSearch;
-    
+
     protected SearchBuilder<HostVO> UUIDSearch;
 
     protected final GenericSearchBuilder<HostVO, Long> HostsInStatusSearch;
@@ -119,7 +113,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
     @Inject protected HostDetailsDao _detailsDao;
     @Inject protected HostTagsDao _hostTagsDao;
     @Inject protected ClusterDao _clusterDao;
-    
+
 
     public HostDaoImpl() {
 
@@ -148,7 +142,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
         TypeDcSearch.and("type", TypeDcSearch.entity().getType(), SearchCriteria.Op.EQ);
         TypeDcSearch.and("dc", TypeDcSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
         TypeDcSearch.done();
-        
+
         SecondaryStorageVMSearch = createSearchBuilder();
         SecondaryStorageVMSearch.and("type", SecondaryStorageVMSearch.entity().getType(), SearchCriteria.Op.EQ);
         SecondaryStorageVMSearch.and("dc", SecondaryStorageVMSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
@@ -161,14 +155,14 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
         TypeDcStatusSearch.and("status", TypeDcStatusSearch.entity().getStatus(), SearchCriteria.Op.EQ);
         TypeDcStatusSearch.and("resourceState", TypeDcStatusSearch.entity().getResourceState(), SearchCriteria.Op.EQ);
         TypeDcStatusSearch.done();
-        
+
         TypeClusterStatusSearch = createSearchBuilder();
         TypeClusterStatusSearch.and("type", TypeClusterStatusSearch.entity().getType(), SearchCriteria.Op.EQ);
         TypeClusterStatusSearch.and("cluster", TypeClusterStatusSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
         TypeClusterStatusSearch.and("status", TypeClusterStatusSearch.entity().getStatus(), SearchCriteria.Op.EQ);
         TypeClusterStatusSearch.and("resourceState", TypeClusterStatusSearch.entity().getResourceState(), SearchCriteria.Op.EQ);
         TypeClusterStatusSearch.done();
-        
+
         IdStatusSearch = createSearchBuilder();
         IdStatusSearch.and("id", IdStatusSearch.entity().getId(), SearchCriteria.Op.EQ);
         IdStatusSearch.and("states", IdStatusSearch.entity().getStatus(), SearchCriteria.Op.IN);
@@ -214,7 +208,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
         StatusSearch = createSearchBuilder();
         StatusSearch.and("status", StatusSearch.entity().getStatus(), SearchCriteria.Op.IN);
         StatusSearch.done();
-        
+
         ResourceStateSearch = createSearchBuilder();
         ResourceStateSearch.and("resourceState", ResourceStateSearch.entity().getResourceState(), SearchCriteria.Op.IN);
         ResourceStateSearch.done();
@@ -299,7 +293,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
         ManagedRoutingServersSearch.and("server", ManagedRoutingServersSearch.entity().getManagementServerId(), SearchCriteria.Op.NNULL);
         ManagedRoutingServersSearch.and("type", ManagedRoutingServersSearch.entity().getType(), SearchCriteria.Op.EQ);
         ManagedRoutingServersSearch.done();
-        
+
         RoutingSearch = createSearchBuilder();
         RoutingSearch.and("type", RoutingSearch.entity().getType(), SearchCriteria.Op.EQ);
         RoutingSearch.done();
@@ -310,11 +304,11 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
         _resourceStateAttr = _allAttributes.get("resourceState");
 
         assert (_statusAttr != null && _msIdAttr != null && _pingTimeAttr != null) : "Couldn't find one of these attributes";
-        
-	    UUIDSearch = createSearchBuilder();
-	    UUIDSearch.and("uuid", UUIDSearch.entity().getUuid(), SearchCriteria.Op.EQ);
-	    UUIDSearch.done();
-	    
+
+        UUIDSearch = createSearchBuilder();
+        UUIDSearch.and("uuid", UUIDSearch.entity().getUuid(), SearchCriteria.Op.EQ);
+        UUIDSearch.done();
+
         StateChangeSearch = createSearchBuilder();
         StateChangeSearch.and("id", StateChangeSearch.entity().getId(), SearchCriteria.Op.EQ);
         StateChangeSearch.and("state", StateChangeSearch.entity().getState(), SearchCriteria.Op.EQ);
@@ -331,52 +325,52 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
         List<HostVO> hosts = listBy(sc);
         return hosts.size();
     }
-    
+
 
     @Override
     public HostVO findByGuid(String guid) {
         SearchCriteria<HostVO> sc = GuidSearch.create("guid", guid);
         return findOneBy(sc);
     }
-    
+
     @Override @DB
     public List<HostVO> findAndUpdateDirectAgentToLoad(long lastPingSecondsAfter, Long limit, long managementServerId) {
         Transaction txn = Transaction.currentTxn();
         txn.start();       
-    	SearchCriteria<HostVO> sc = UnmanagedDirectConnectSearch.create();
-    	sc.setParameters("lastPinged", lastPingSecondsAfter);
+        SearchCriteria<HostVO> sc = UnmanagedDirectConnectSearch.create();
+        sc.setParameters("lastPinged", lastPingSecondsAfter);
         //sc.setParameters("resourceStates", ResourceState.ErrorInMaintenance, ResourceState.Maintenance, ResourceState.PrepareForMaintenance, ResourceState.Disabled);
         sc.setJoinParameters("ClusterManagedSearch", "managed", Managed.ManagedState.Managed);
         List<HostVO> hosts = lockRows(sc, new Filter(HostVO.class, "clusterId", true, 0L, limit), true);
-        
+
         for (HostVO host : hosts) {
             host.setManagementServerId(managementServerId);
             update(host.getId(), host);
         }
-        
+
         txn.commit();
-        
+
         return hosts;
     }
-    
+
     @Override @DB
     public List<HostVO> findAndUpdateApplianceToLoad(long lastPingSecondsAfter, long managementServerId) {
-    	Transaction txn = Transaction.currentTxn();
-    	
-    	txn.start();
-    	SearchCriteria<HostVO> sc = UnmanagedApplianceSearch.create();
-    	sc.setParameters("lastPinged", lastPingSecondsAfter);
+        Transaction txn = Transaction.currentTxn();
+
+        txn.start();
+        SearchCriteria<HostVO> sc = UnmanagedApplianceSearch.create();
+        sc.setParameters("lastPinged", lastPingSecondsAfter);
         sc.setParameters("types", Type.ExternalDhcp, Type.ExternalFirewall, Type.ExternalLoadBalancer, Type.PxeServer, Type.TrafficMonitor, Type.L2Networking);
-    	List<HostVO> hosts = lockRows(sc, null, true);
-    	
-    	for (HostVO host : hosts) {
-    		host.setManagementServerId(managementServerId);
-    		update(host.getId(), host);
-    	}
-    	
-    	txn.commit();
-    	
-    	return hosts;
+        List<HostVO> hosts = lockRows(sc, null, true);
+
+        for (HostVO host : hosts) {
+            host.setManagementServerId(managementServerId);
+            update(host.getId(), host);
+        }
+
+        txn.commit();
+
+        return hosts;
     }
 
     @Override
@@ -402,7 +396,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
         ub = getUpdateBuilder(host);
         update(ub, sc, null);
     }
- 
+
     @Override
     public List<HostVO> listByHostTag(Host.Type type, Long clusterId, Long podId, long dcId, String hostTag) {
 
@@ -435,8 +429,8 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
 
         return listBy(sc);
     }
-    
-    
+
+
     @Override
     public List<HostVO> listAllUpAndEnabledNonHAHosts(Type type, Long clusterId, Long podId, long dcId, String haTag) {
         SearchBuilder<HostTagVO> hostTagSearch = null;
@@ -446,42 +440,42 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
             hostTagSearch.or("tagNull", hostTagSearch.entity().getTag(), SearchCriteria.Op.NULL);
             hostTagSearch.cp();
         }
-        
+
         SearchBuilder<HostVO> hostSearch = createSearchBuilder();
-     
+
         hostSearch.and("type", hostSearch.entity().getType(), SearchCriteria.Op.EQ);
         hostSearch.and("clusterId", hostSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
         hostSearch.and("podId", hostSearch.entity().getPodId(), SearchCriteria.Op.EQ);
         hostSearch.and("zoneId", hostSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
         hostSearch.and("status", hostSearch.entity().getStatus(), SearchCriteria.Op.EQ);
         hostSearch.and("resourceState", hostSearch.entity().getResourceState(), SearchCriteria.Op.EQ);
-        
+
         if (haTag != null && !haTag.isEmpty()) {
             hostSearch.join("hostTagSearch", hostTagSearch, hostSearch.entity().getId(), hostTagSearch.entity().getHostId(), JoinBuilder.JoinType.LEFTOUTER);
         }
 
         SearchCriteria<HostVO> sc = hostSearch.create();
-        
+
         if (haTag != null && !haTag.isEmpty()) {
             sc.setJoinParameters("hostTagSearch", "tag", haTag);
         }
-        
+
         if (type != null) {
             sc.setParameters("type", type);
         }
-        
+
         if (clusterId != null) {
             sc.setParameters("clusterId", clusterId);
         }
-        
+
         if (podId != null) {
             sc.setParameters("podId", podId);
         }
-        
+
         sc.setParameters("zoneId", dcId);
         sc.setParameters("status", Status.Up);
         sc.setParameters("resourceState", ResourceState.Enabled);
-        
+
         return listBy(sc);
     }
 
@@ -528,7 +522,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
         }
         return result;
     }
-   
+
     @Override
     public void saveDetails(HostVO host) {
         Map<String, String> details = host.getDetails();
@@ -650,12 +644,12 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
     }
 
 
-	@Override
-	public boolean updateState(State currentState, DataCenterResourceEntity.State.Event event, State nextState, DataCenterResourceEntity hostEntity, Object data) {
-		HostVO vo = findById(hostEntity.getId());
-		Date oldUpdatedTime = vo.getLastUpdated();
+    @Override
+    public boolean updateState(State currentState, DataCenterResourceEntity.State.Event event, State nextState, DataCenterResourceEntity hostEntity, Object data) {
+        HostVO vo = findById(hostEntity.getId());
+        Date oldUpdatedTime = vo.getLastUpdated();
 
-		SearchCriteria<HostVO> sc = StateChangeSearch.create();
+        SearchCriteria<HostVO> sc = StateChangeSearch.create();
         sc.setParameters("id", hostEntity.getId());
         sc.setParameters("state", currentState);
 
@@ -663,14 +657,14 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
         builder.set(vo, "state", nextState);
         builder.set(vo, "lastUpdated", new Date());
 
-        int rows = update((HostVO) vo, sc);
-        
+        int rows = update(vo, sc);
+
         if (rows == 0 && s_logger.isDebugEnabled()) {
-        	HostVO dbHost = findByIdIncludingRemoved(vo.getId());
+            HostVO dbHost = findByIdIncludingRemoved(vo.getId());
             if (dbHost != null) {
                 StringBuilder str = new StringBuilder("Unable to update ").append(vo.toString());
                 str.append(": DB Data={id=").append(dbHost.getId()).append("; state=").append(dbHost.getState()).append(";updatedTime=")
-                        .append(dbHost.getLastUpdated());
+                .append(dbHost.getLastUpdated());
                 str.append(": New Data={id=").append(vo.getId()).append("; state=").append(nextState).append("; event=").append(event).append("; updatedTime=").append(vo.getLastUpdated());
                 str.append(": stale Data={id=").append(vo.getId()).append("; state=").append(currentState).append("; event=").append(event).append("; updatedTime=").append(oldUpdatedTime);
             } else {
@@ -678,8 +672,8 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
             }
         }
         return rows > 0;
-	}
-	
+    }
+
     @Override
     public boolean updateResourceState(ResourceState oldState, ResourceState.Event event, ResourceState newState, Host vo) {
         HostVO host = (HostVO)vo;
@@ -687,41 +681,41 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
         sb.and("resource_state", sb.entity().getResourceState(), SearchCriteria.Op.EQ);
         sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
         sb.done();
-        
+
         SearchCriteria<HostVO> sc = sb.create();
 
         sc.setParameters("resource_state", oldState);
         sc.setParameters("id", host.getId());
-        
+
         UpdateBuilder ub = getUpdateBuilder(host);
         ub.set(host, _resourceStateAttr, newState);
         int result = update(ub, sc, null);
         assert result <= 1 : "How can this update " + result + " rows? ";
-        
+
         if (state_logger.isDebugEnabled() && result == 0) {
             HostVO ho = findById(host.getId());
             assert ho != null : "How how how? : " + host.getId();
 
             StringBuilder str = new StringBuilder("Unable to update resource state: [");
-			str.append("m = " + host.getId());
-			str.append("; name = " + host.getName());
-			str.append("; old state = " + oldState);
-			str.append("; event = " + event);
-			str.append("; new state = " + newState + "]");
-			state_logger.debug(str.toString());
+            str.append("m = " + host.getId());
+            str.append("; name = " + host.getName());
+            str.append("; old state = " + oldState);
+            str.append("; event = " + event);
+            str.append("; new state = " + newState + "]");
+            state_logger.debug(str.toString());
         } else {
-			StringBuilder msg = new StringBuilder("Resource state update: [");
-			msg.append("id = " + host.getId());
-			msg.append("; name = " + host.getName());
-			msg.append("; old state = " + oldState);
-			msg.append("; event = " + event);
-			msg.append("; new state = " + newState + "]");
-			state_logger.debug(msg.toString());
+            StringBuilder msg = new StringBuilder("Resource state update: [");
+            msg.append("id = " + host.getId());
+            msg.append("; name = " + host.getName());
+            msg.append("; old state = " + oldState);
+            msg.append("; event = " + event);
+            msg.append("; new state = " + newState + "]");
+            state_logger.debug(msg.toString());
         }
-		
+
         return result > 0;
     }
-    
+
     @Override
     public HostVO findByTypeNameAndZoneId(long zoneId, String name, Host.Type type) {
         SearchCriteria<HostVO> sc = TypeNameZoneSearch.create();
@@ -731,94 +725,94 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
         return findOneBy(sc);
     }
 
-	@Override
-	public List<HostVO> findHypervisorHostInCluster(long clusterId) {
-		 SearchCriteria<HostVO> sc = TypeClusterStatusSearch.create();
-		 sc.setParameters("type", Host.Type.Routing);
-		 sc.setParameters("cluster", clusterId);
-		 sc.setParameters("status", Status.Up);
-		 sc.setParameters("resourceState", ResourceState.Enabled);
-		
-		return listBy(sc);
-	}
-
-	@Override
-	public List<org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO> lockRows(
-			SearchCriteria<org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO> sc,
-			Filter filter, boolean exclusive) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO lockOneRandomRow(
-			SearchCriteria<org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO> sc,
-			boolean exclusive) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-
-	@Override
-	public List<org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO> search(
-			SearchCriteria<org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO> sc,
-			Filter filter) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public List<org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO> search(
-			SearchCriteria<org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO> sc,
-			Filter filter, boolean enable_query_cache) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public List<org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO> searchIncludingRemoved(
-			SearchCriteria<org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO> sc,
-			Filter filter, Boolean lock, boolean cache) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public List<HostVO> searchIncludingRemoved(
-			SearchCriteria<HostVO> sc,
-			Filter filter, Boolean lock, boolean cache,
-			boolean enable_query_cache) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-
-	@Override
-	public int remove(
-			SearchCriteria<HostVO> sc) {
-		// TODO Auto-generated method stub
-		return 0;
-	}
-
-	@Override
-	public int expunge(SearchCriteria<HostVO> sc) {
-		// TODO Auto-generated method stub
-		return 0;
-	}
-
-	@Override
-	public HostVO findOneBy(SearchCriteria<HostVO> sc) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-
-
-	@Override
-	public HostVO findByUUID(String uuid) {
-    	SearchCriteria<HostVO> sc = UUIDSearch.create();
-    	sc.setParameters("uuid", uuid);
+    @Override
+    public List<HostVO> findHypervisorHostInCluster(long clusterId) {
+        SearchCriteria<HostVO> sc = TypeClusterStatusSearch.create();
+        sc.setParameters("type", Host.Type.Routing);
+        sc.setParameters("cluster", clusterId);
+        sc.setParameters("status", Status.Up);
+        sc.setParameters("resourceState", ResourceState.Enabled);
+
+        return listBy(sc);
+    }
+
+    @Override
+    public List<org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO> lockRows(
+            SearchCriteria<org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO> sc,
+            Filter filter, boolean exclusive) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO lockOneRandomRow(
+            SearchCriteria<org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO> sc,
+            boolean exclusive) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    @Override
+    public List<org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO> search(
+            SearchCriteria<org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO> sc,
+            Filter filter) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public List<org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO> search(
+            SearchCriteria<org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO> sc,
+            Filter filter, boolean enable_query_cache) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public List<org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO> searchIncludingRemoved(
+            SearchCriteria<org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO> sc,
+            Filter filter, Boolean lock, boolean cache) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public List<HostVO> searchIncludingRemoved(
+            SearchCriteria<HostVO> sc,
+            Filter filter, Boolean lock, boolean cache,
+            boolean enable_query_cache) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    @Override
+    public int remove(
+            SearchCriteria<HostVO> sc) {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public int expunge(SearchCriteria<HostVO> sc) {
+        // TODO Auto-generated method stub
+        return 0;
+    }
+
+    @Override
+    public HostVO findOneBy(SearchCriteria<HostVO> sc) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+
+    @Override
+    public HostVO findByUUID(String uuid) {
+        SearchCriteria<HostVO> sc = UUIDSearch.create();
+        sc.setParameters("uuid", uuid);
         return findOneBy(sc);
-	}
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f40e7b75/engine/storage/image/src/org/apache/cloudstack/storage/image/provider/DefaultImageDataStoreProvider.java
----------------------------------------------------------------------
diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/provider/DefaultImageDataStoreProvider.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/provider/DefaultImageDataStoreProvider.java
index f87299d..363ed5f 100644
--- a/engine/storage/image/src/org/apache/cloudstack/storage/image/provider/DefaultImageDataStoreProvider.java
+++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/provider/DefaultImageDataStoreProvider.java
@@ -18,8 +18,6 @@
  */
 package org.apache.cloudstack.storage.image.provider;
 
-import java.util.Map;
-
 import javax.inject.Inject;
 
 import org.apache.cloudstack.storage.image.db.ImageDataStoreDao;
@@ -34,7 +32,7 @@ import org.apache.cloudstack.storage.image.store.lifecycle.DefaultImageDataStore
 import org.apache.cloudstack.storage.image.store.lifecycle.ImageDataStoreLifeCycle;
 import org.springframework.stereotype.Component;
 
-import com.cloud.utils.component.ComponentInject;
+import com.cloud.utils.component.ComponentContext;
 
 @Component
 public class DefaultImageDataStoreProvider implements ImageDataStoreProvider {
@@ -50,7 +48,7 @@ public class DefaultImageDataStoreProvider implements ImageDataStoreProvider {
         ImageDataStoreVO idsv = imageStoreDao.findById(imageStoreId);
         ImageDataStoreDriver driver = new ImageDataStoreDriverImpl();
         ImageDataStore ids = new ImageDataStoreImpl(idsv, driver, false);
-        ids = ComponentInject.inject(ids);
+        ids = ComponentContext.inject(ids);
         return ids;
     }
 
@@ -72,6 +70,6 @@ public class DefaultImageDataStoreProvider implements ImageDataStoreProvider {
 
     @Override
     public ImageDataStoreLifeCycle getLifeCycle() {
-    	return new DefaultImageDataStoreLifeCycle(this, provider, imageStoreDao);
+        return new DefaultImageDataStoreLifeCycle(this, provider, imageStoreDao);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f40e7b75/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStore.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStore.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStore.java
index 571f227..ddcb365 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStore.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStore.java
@@ -6,7 +6,6 @@ import java.util.List;
 import javax.inject.Inject;
 
 import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity;
-import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
 import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreLifeCycle;
 import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreProvider;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
@@ -27,13 +26,12 @@ import org.apache.cloudstack.storage.volume.TemplatePrimaryDataStoreManager;
 import org.apache.cloudstack.storage.volume.VolumeObject;
 import org.apache.cloudstack.storage.volume.db.VolumeDao2;
 import org.apache.cloudstack.storage.volume.db.VolumeVO;
-
 import org.apache.log4j.Logger;
 
 import com.cloud.host.HostVO;
 import com.cloud.host.dao.HostDao;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.utils.component.ComponentInject;
+import com.cloud.utils.component.ComponentContext;
 import com.cloud.utils.exception.CloudRuntimeException;
 
 import edu.emory.mathcs.backport.java.util.Collections;
@@ -55,42 +53,42 @@ public class DefaultPrimaryDataStore implements PrimaryDataStore {
     private PrimaryDataStoreDao dataStoreDao;
     @Inject
     private TemplatePrimaryDataStoreManager templatePrimaryStoreMgr;
-    
+
     private DefaultPrimaryDataStore(PrimaryDataStoreVO pdsv) {
         this.pdsv = pdsv;
     }
-    
+
     public void setDriver(PrimaryDataStoreDriver driver) {
         driver.setDataStore(this);
         this.driver = driver;
     }
-    
+
     public void setLifeCycle(PrimaryDataStoreLifeCycle lifeCycle) {
         lifeCycle.setDataStore(this);
         this.lifeCycle = lifeCycle;
     }
-    
+
     public void setProvider(PrimaryDataStoreProvider provider) {
         this.provider = provider;
     }
-    
+
     public void setProtocolTransFormer(StorageProtocolTransformer transformer) {
         this.protocalTransformer = transformer;
     }
-    
+
     @Override
     public PrimaryDataStoreTO getDataStoreTO() {
         return this.protocalTransformer.getDataStoreTO(this);
     }
-    
+
     @Override
     public VolumeTO getVolumeTO(VolumeInfo volume) {
         return this.protocalTransformer.getVolumeTO(volume);
     }
-    
+
     public static DefaultPrimaryDataStore createDataStore(PrimaryDataStoreVO pdsv) {
         DefaultPrimaryDataStore dataStore = new DefaultPrimaryDataStore(pdsv);
-        return ComponentInject.inject(dataStore);
+        return ComponentContext.inject(dataStore);
     }
 
     @Override
@@ -130,12 +128,12 @@ public class DefaultPrimaryDataStore implements PrimaryDataStore {
                 return new ArrayList<EndPoint>();
             }
         }
-        
+
         List<EndPoint> endpoints = new ArrayList<EndPoint>();
         List<HostVO> hosts = hostDao.findHypervisorHostInCluster(clusterId);
         for (HostVO host : hosts) {
             HypervisorHostEndPoint ep = new HypervisorHostEndPoint(host.getId(), host.getPrivateIpAddress());
-            ComponentInject.inject(ep);
+            ComponentContext.inject(ep);
             endpoints.add(ep);
         }
         Collections.shuffle(endpoints);
@@ -145,12 +143,12 @@ public class DefaultPrimaryDataStore implements PrimaryDataStore {
     public void setSupportedHypervisor(HypervisorType type) {
         this.supportedHypervisor = type;
     }
-    
+
     @Override
     public boolean isHypervisorSupported(HypervisorType hypervisor) {
         return (this.supportedHypervisor == hypervisor) ? true : false;
     }
-    
+
     public void setLocalStorageFlag(boolean supported) {
         this.isLocalStorageSupported = supported;
     }
@@ -167,7 +165,7 @@ public class DefaultPrimaryDataStore implements PrimaryDataStore {
 
     @Override
     public long getCapacity() {
-       return this.driver.getCapacity();
+        return this.driver.getCapacity();
     }
 
     @Override
@@ -219,7 +217,7 @@ public class DefaultPrimaryDataStore implements PrimaryDataStore {
         //this.driver.createVolumeFromBaseImage(vo, template);
         return volume;
     }
-    
+
     @Override
     public void createVoluemFromBaseImageAsync(VolumeInfo volume, TemplateOnPrimaryDataStoreInfo templateStore, AsyncCompletionCallback<CommandResult> callback) {
         VolumeObject vo = (VolumeObject) volume;
@@ -227,7 +225,7 @@ public class DefaultPrimaryDataStore implements PrimaryDataStore {
 
         this.driver.createVolumeFromBaseImageAsync(vo, templateStore, callback);
     }
-    
+
     @Override
     public boolean installTemplate(TemplateOnPrimaryDataStoreInfo template) {
         // TODO Auto-generated method stub
@@ -264,5 +262,5 @@ public class DefaultPrimaryDataStore implements PrimaryDataStore {
         return this.provider;
     }
 
-    
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f40e7b75/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmNfsConfigurator.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmNfsConfigurator.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmNfsConfigurator.java
index 6897e54..1c36f15 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmNfsConfigurator.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/kvm/KvmNfsConfigurator.java
@@ -18,19 +18,21 @@
  */
 package org.apache.cloudstack.storage.datastore.configurator.kvm;
 
+import javax.inject.Inject;
+
 import org.apache.cloudstack.storage.datastore.configurator.validator.NfsProtocolTransformer;
 import org.apache.cloudstack.storage.datastore.configurator.validator.StorageProtocolTransformer;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Component;
 
-import com.cloud.utils.component.Inject;
 
 @Component
 @Qualifier("defaultProvider")
 public class KvmNfsConfigurator extends AbstractKvmConfigurator {
     @Inject
     PrimaryDataStoreDao dataStoreDao;
+
     @Override
     public String getSupportedDataStoreType() {
         return "nfs";

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f40e7b75/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/vmware/VmwareNfsConfigurator.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/vmware/VmwareNfsConfigurator.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/vmware/VmwareNfsConfigurator.java
index c6afc13..afd8d21 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/vmware/VmwareNfsConfigurator.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/vmware/VmwareNfsConfigurator.java
@@ -18,15 +18,14 @@
  */
 package org.apache.cloudstack.storage.datastore.configurator.vmware;
 
+import javax.inject.Inject;
+
 import org.apache.cloudstack.storage.datastore.configurator.validator.NfsProtocolTransformer;
 import org.apache.cloudstack.storage.datastore.configurator.validator.StorageProtocolTransformer;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Component;
 
-import com.cloud.storage.Storage.StoragePoolType;
-import com.cloud.utils.component.Inject;
-
 @Component
 @Qualifier("defaultProvider")
 public class VmwareNfsConfigurator extends AbstractVmwareConfigurator {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f40e7b75/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/xen/XenNfsConfigurator.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/xen/XenNfsConfigurator.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/xen/XenNfsConfigurator.java
index 6ad4b53..0cb24a8 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/xen/XenNfsConfigurator.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/configurator/xen/XenNfsConfigurator.java
@@ -20,26 +20,22 @@ package org.apache.cloudstack.storage.datastore.configurator.xen;
 
 import org.apache.cloudstack.storage.datastore.configurator.validator.NfsProtocolTransformer;
 import org.apache.cloudstack.storage.datastore.configurator.validator.StorageProtocolTransformer;
-import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.protocol.DataStoreProtocol;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Component;
 
-import com.cloud.storage.Storage.StoragePoolType;
-import com.cloud.utils.component.Inject;
-
 @Component
 @Qualifier("defaultProvider")
 public class XenNfsConfigurator extends AbstractXenConfigurator {
-	@Override
-	public String getSupportedDataStoreType() {
-		return DataStoreProtocol.NFS.toString();
-	}
+    @Override
+    public String getSupportedDataStoreType() {
+        return DataStoreProtocol.NFS.toString();
+    }
 
-	@Override
-	public StorageProtocolTransformer getProtocolTransformer() {
-		return new NfsProtocolTransformer(dataStoreDao);
-	}
+    @Override
+    public StorageProtocolTransformer getProtocolTransformer() {
+        return new NfsProtocolTransformer(dataStoreDao);
+    }
 
     @Override
     protected boolean isLocalStorageSupported() {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f40e7b75/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
index 247cdee..99cb001 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
@@ -31,19 +31,14 @@ import javax.naming.ConfigurationException;
 import org.apache.cloudstack.storage.datastore.DataStoreStatus;
 import org.springframework.stereotype.Component;
 
-import com.cloud.storage.StoragePoolDetailVO;
-import com.cloud.storage.dao.StoragePoolDetailsDao;
-import com.cloud.storage.dao.StoragePoolDetailsDaoImpl;
-import com.cloud.utils.component.ComponentInject;
-import com.cloud.utils.component.ComponentLocator;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.GenericDaoBase;
 import com.cloud.utils.db.GenericSearchBuilder;
 import com.cloud.utils.db.SearchBuilder;
 import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.db.Transaction;
 import com.cloud.utils.db.SearchCriteria.Func;
 import com.cloud.utils.db.SearchCriteria.Op;
+import com.cloud.utils.db.Transaction;
 import com.cloud.utils.exception.CloudRuntimeException;
 
 @Component
@@ -101,7 +96,7 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase<PrimaryDataStoreVO,
         StatusCountSearch.select(null, Func.COUNT, null);
         StatusCountSearch.done();
 
-       // _detailsDao = ComponentInject.inject(PrimaryDataStoreDetailsDaoImpl.class);
+        // _detailsDao = ComponentInject.inject(PrimaryDataStoreDetailsDaoImpl.class);
     }
 
     @Override


Mime
View raw message