cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject [56/57] [abbrv] Renamed internal classes to use "imageStorexxx" instead of previous "imageDataStorexxx". Add new addImageStoreCmd to use 3 image store provider plugins.
Date Sat, 06 Apr 2013 00:35:29 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageDataStoreInfo.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageDataStoreInfo.java b/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageDataStoreInfo.java
deleted file mode 100644
index b6b9a2a..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageDataStoreInfo.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.image.datastore;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-
-public interface ImageDataStoreInfo extends DataStore {
-    public long getImageDataStoreId();
-    public String getType();
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageDataStoreProviderManager.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageDataStoreProviderManager.java b/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageDataStoreProviderManager.java
deleted file mode 100644
index 4ab3f3c..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageDataStoreProviderManager.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.image.datastore;
-
-import java.util.List;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.storage.image.ImageDataStoreDriver;
-
-public interface ImageDataStoreProviderManager {
-    ImageDataStore getImageDataStore(long dataStoreId);
-    ImageDataStore getImageDataStore(String uuid);
-    List<DataStore> getList();
-    boolean registerDriver(String uuid, ImageDataStoreDriver driver);
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreEntity.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreEntity.java b/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreEntity.java
new file mode 100644
index 0000000..fb1b1d7
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreEntity.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cloudstack.storage.image.datastore;
+
+import java.util.Set;
+
+import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
+import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
+import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
+
+import com.cloud.storage.ImageStore;
+
+public interface ImageStoreEntity extends DataStore, ImageStore {
+    TemplateInfo getTemplate(long templateId);
+    VolumeInfo getVolume(long volumeId);
+    SnapshotInfo getSnapshot(long snapshotId);
+    boolean exists(DataObject object);
+    Set<TemplateInfo> listTemplates();
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreHelper.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreHelper.java b/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreHelper.java
new file mode 100644
index 0000000..30ebd1d
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreHelper.java
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cloudstack.storage.image.datastore;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.storage.image.db.ImageStoreDao;
+import org.apache.cloudstack.storage.image.db.ImageStoreDetailVO;
+import org.apache.cloudstack.storage.image.db.ImageStoreDetailsDao;
+import org.apache.cloudstack.storage.image.db.ImageStoreVO;
+import org.springframework.stereotype.Component;
+
+import com.cloud.storage.ImageStore;
+import com.cloud.storage.ScopeType;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@Component
+public class ImageStoreHelper {
+    @Inject
+    ImageStoreDao imageStoreDao;
+    @Inject
+    ImageStoreDetailsDao imageStoreDetailsDao;
+
+    public ImageStoreVO createImageStore(Map<String, Object> params) {
+        ImageStoreVO store = imageStoreDao.findByName((String)params.get("name"));
+        if (store != null) {
+            return store;
+        }
+        store = new ImageStoreVO();
+        store.setName((String)params.get("name"));
+        store.setProtocol((String)params.get("protocol"));
+        store.setProviderName((String)params.get("providerName"));
+        store.setScope((ScopeType)params.get("scope"));
+        store.setUuid((String)params.get("uuid"));
+        store.setUrl((String)params.get("url"));
+        store.setState(ImageStore.State.Disabled);
+        store = imageStoreDao.persist(store);
+        return store;
+    }
+
+    public ImageStoreVO createImageStore(Map<String, Object> params, Map<String, String> details) {
+        ImageStoreVO store = imageStoreDao.findByName((String)params.get("name"));
+        if (store != null) {
+            return store;
+        }
+        store = new ImageStoreVO();
+        store.setName((String)params.get("name"));
+        store.setProtocol((String)params.get("protocol"));
+        store.setProviderName((String)params.get("providerName"));
+        store.setScope((ScopeType)params.get("scope"));
+        store.setUuid((String)params.get("uuid"));
+        store.setUrl((String)params.get("url"));
+        store.setState(ImageStore.State.Disabled);
+        store = imageStoreDao.persist(store);
+
+        // persist details
+        if (details != null){
+            Iterator<String> keyIter = details.keySet().iterator();
+            while (keyIter.hasNext()){
+                String key = keyIter.next();
+                ImageStoreDetailVO detail = new ImageStoreDetailVO();
+                detail.setStoreId(store.getId());
+                detail.setName(key);
+                detail.setValue(details.get(key));
+                imageStoreDetailsDao.persist(detail);
+            }
+        }
+        return store;
+    }
+
+    public boolean deleteImageStore(long id) {
+        ImageStoreVO store = imageStoreDao.findById(id);
+        if (store == null) {
+            throw new CloudRuntimeException("can't find image store:" + id);
+        }
+
+        imageStoreDao.remove(id);
+        return true;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreInfo.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreInfo.java b/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreInfo.java
new file mode 100644
index 0000000..c5f7ca9
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreInfo.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cloudstack.storage.image.datastore;
+
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
+
+public interface ImageStoreInfo extends DataStore {
+    public long getImageStoreId();
+    public String getType();
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreProviderManager.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreProviderManager.java b/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreProviderManager.java
new file mode 100644
index 0000000..d9a733d
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageStoreProviderManager.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cloudstack.storage.image.datastore;
+
+import java.util.List;
+
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.storage.image.ImageStoreDriver;
+
+public interface ImageStoreProviderManager {
+    ImageStoreEntity getImageStore(long dataStoreId);
+    ImageStoreEntity getImageStore(String uuid);
+    List<DataStore> getList();
+    boolean registerDriver(String uuid, ImageStoreDriver driver);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDaoStoreDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDaoStoreDaoImpl.java b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDaoStoreDaoImpl.java
deleted file mode 100644
index 3f3e9ca..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDaoStoreDaoImpl.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.image.db;
-
-import org.springframework.stereotype.Component;
-
-import com.cloud.utils.db.GenericDaoBase;
-import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
-import com.cloud.utils.db.SearchCriteria.Op;
-
-@Component
-public class ImageDaoStoreDaoImpl extends GenericDaoBase<ImageDataStoreVO, Long> implements ImageDataStoreDao {
-
-    @Override
-    public ImageDataStoreVO findByName(String name) {
-        SearchCriteriaService<ImageDataStoreVO, ImageDataStoreVO> sc =  SearchCriteria2.create(ImageDataStoreVO.class);
-        sc.addAnd(sc.getEntity().getName(), Op.EQ, name);
-        return sc.find();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreDao.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreDao.java b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreDao.java
deleted file mode 100644
index d7358be..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreDao.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.image.db;
-
-import com.cloud.utils.db.GenericDao;
-
-public interface ImageDataStoreDao extends GenericDao<ImageDataStoreVO, Long> {
-    public ImageDataStoreVO findByName(String name);
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderDao.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderDao.java b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderDao.java
deleted file mode 100644
index 1b13b7a..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderDao.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.image.db;
-
-import com.cloud.utils.db.GenericDao;
-
-public interface ImageDataStoreProviderDao extends GenericDao<ImageDataStoreProviderVO, Long> {
-    public ImageDataStoreProviderVO findByName(String name);
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderDaoImpl.java b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderDaoImpl.java
deleted file mode 100644
index 0e19dbe..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderDaoImpl.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.image.db;
-
-import org.springframework.stereotype.Component;
-
-import com.cloud.utils.db.GenericDaoBase;
-import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
-import com.cloud.utils.db.SearchCriteria.Op;
-
-@Component
-public class ImageDataStoreProviderDaoImpl extends GenericDaoBase<ImageDataStoreProviderVO, Long> implements ImageDataStoreProviderDao {
-
-	public ImageDataStoreProviderDaoImpl() {
-	}
-	
-	@Override
-    public ImageDataStoreProviderVO findByName(String name) {
-        SearchCriteriaService<ImageDataStoreProviderVO, ImageDataStoreProviderVO> service = SearchCriteria2.create(ImageDataStoreProviderVO.class);
-        service.addAnd(service.getEntity().getName(), Op.EQ, name);
-        return service.find();
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderVO.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderVO.java b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderVO.java
deleted file mode 100644
index 5cc5b8d..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderVO.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.image.db;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.TableGenerator;
-
-@Entity
-@Table(name = "image_data_store_provider")
-public class ImageDataStoreProviderVO {
-    @Id
-    @TableGenerator(name = "image_data_store_provider_sq", table = "sequence", pkColumnName = "name", valueColumnName = "value", pkColumnValue = "image_data_store_provider_seq", allocationSize = 1)
-    @Column(name = "id", nullable = false)
-    private long id;
-
-    @Column(name = "name", nullable = false)
-    private String name;
-
-    public long getId() {
-        return this.id;
-    }
-
-    public String getName() {
-        return this.name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreVO.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreVO.java b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreVO.java
deleted file mode 100644
index 3e0d838..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreVO.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.image.db;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.TableGenerator;
-
-
-import com.cloud.storage.ObjectStore;
-import com.cloud.storage.ScopeType;
-
-@Entity
-@Table(name = "image_data_store")
-public class ImageDataStoreVO implements ObjectStore {
-    @Id
-    @TableGenerator(name = "image_data_store_sq", table = "sequence", pkColumnName = "name", valueColumnName = "value", pkColumnValue = "image_data_store_seq", allocationSize = 1)
-    @Column(name = "id", nullable = false)
-    private long id;
-
-    @Column(name = "name", nullable = false)
-    private String name;
-
-    @Column(name = "uuid", nullable = false)
-    private String uuid;
-
-    @Column(name = "protocol", nullable = false)
-    private String protocol;
-
-    @Column(name = "url", nullable = false)
-    private String url;
-
-    @Column(name = "image_provider_name", nullable = false)
-    private String providerName;
-
-    @Column(name = "data_center_id")
-    private long dcId;
-
-    @Column(name = "region_id")
-    private long regionId;
-
-    @Column(name = "scope")
-    @Enumerated(value = EnumType.STRING)
-    private ScopeType scope;
-
-
-    public long getId() {
-        return this.id;
-    }
-
-    public String getName() {
-        return this.name;
-    }
-
-    public String getProviderName() {
-        return this.providerName;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public void setProviderName(String provider) {
-        this.providerName = provider;
-    }
-
-    public void setProtocol(String protocol) {
-        this.protocol = protocol;
-    }
-
-    public String getProtocol() {
-        return this.protocol;
-    }
-
-    public void setDataCenterId(long dcId) {
-        this.dcId = dcId;
-    }
-
-    public Long getDataCenterId() {
-        return this.dcId;
-    }
-
-
-    public Long getRegionId() {
-        return regionId;
-    }
-
-    public void setRegionId(long regionId) {
-        this.regionId = regionId;
-    }
-
-    public ScopeType getScope() {
-        return this.scope;
-    }
-
-    public void setScope(ScopeType scope) {
-        this.scope = scope;
-    }
-
-    public void setUuid(String uuid) {
-        this.uuid = uuid;
-    }
-
-    public String getUuid() {
-        return this.uuid;
-    }
-
-    public String getUrl() {
-        return url;
-    }
-
-    public void setUrl(String url) {
-        this.url = url;
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDao.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDao.java b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDao.java
new file mode 100644
index 0000000..18841bc
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDao.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cloudstack.storage.image.db;
+
+import com.cloud.utils.db.GenericDao;
+
+public interface ImageStoreDao extends GenericDao<ImageStoreVO, Long> {
+    public ImageStoreVO findByName(String name);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDaoImpl.java b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDaoImpl.java
new file mode 100644
index 0000000..60d414c
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDaoImpl.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cloudstack.storage.image.db;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchCriteria2;
+import com.cloud.utils.db.SearchCriteriaService;
+import com.cloud.utils.db.SearchCriteria.Op;
+
+@Component
+public class ImageStoreDaoImpl extends GenericDaoBase<ImageStoreVO, Long> implements ImageStoreDao {
+
+    @Override
+    public ImageStoreVO findByName(String name) {
+        SearchCriteriaService<ImageStoreVO, ImageStoreVO> sc =  SearchCriteria2.create(ImageStoreVO.class);
+        sc.addAnd(sc.getEntity().getName(), Op.EQ, name);
+        return sc.find();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDetailVO.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDetailVO.java b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDetailVO.java
new file mode 100644
index 0000000..3afddaa
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDetailVO.java
@@ -0,0 +1,83 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.storage.image.db;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="image_store_details")
+public class ImageStoreDetailVO implements InternalIdentity {
+    @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    long id;
+
+    @Column(name="store_id")
+    long storeId;
+
+    @Column(name="name")
+    String name;
+
+    @Column(name="value")
+    String value;
+
+    public ImageStoreDetailVO() {
+    }
+
+    public ImageStoreDetailVO(long storeId, String name, String value) {
+        this.storeId = storeId;
+        this.name = name;
+        this.value = value;
+    }
+
+    public long getId() {
+        return id;
+    }
+
+    public long getStoreId() {
+        return storeId;
+    }
+
+    public void setStoreId(long storeId) {
+        this.storeId = storeId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDetailsDao.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDetailsDao.java b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDetailsDao.java
new file mode 100644
index 0000000..9867290
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDetailsDao.java
@@ -0,0 +1,28 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.storage.image.db;
+
+import java.util.Map;
+
+
+import com.cloud.utils.db.GenericDao;
+
+public interface ImageStoreDetailsDao extends GenericDao<ImageStoreDetailVO, Long> {
+
+    void update(long storeId, Map<String, String> details);
+    Map<String, String> getDetails(long storeId);
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDetailsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDetailsDaoImpl.java b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDetailsDaoImpl.java
new file mode 100644
index 0000000..e96d6fd
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDetailsDaoImpl.java
@@ -0,0 +1,73 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.storage.image.db;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+
+@Component
+@Local(value=ImageStoreDetailsDao.class)
+public class ImageStoreDetailsDaoImpl extends GenericDaoBase<ImageStoreDetailVO, Long> implements ImageStoreDetailsDao {
+
+    protected final SearchBuilder<ImageStoreDetailVO> storeSearch;
+
+    protected ImageStoreDetailsDaoImpl() {
+        super();
+        storeSearch = createSearchBuilder();
+        storeSearch.and("store", storeSearch.entity().getStoreId(), SearchCriteria.Op.EQ);
+        storeSearch.done();
+    }
+
+    @Override
+    public void update(long storeId, Map<String, String> details) {
+        Transaction txn = Transaction.currentTxn();
+        SearchCriteria<ImageStoreDetailVO> sc = storeSearch.create();
+        sc.setParameters("store", storeId);
+
+        txn.start();
+        expunge(sc);
+        for (Map.Entry<String, String> entry : details.entrySet()) {
+            ImageStoreDetailVO detail = new ImageStoreDetailVO(storeId, entry.getKey(), entry.getValue());
+            persist(detail);
+        }
+        txn.commit();
+    }
+
+    @Override
+    public Map<String, String> getDetails(long storeId) {
+    	SearchCriteria<ImageStoreDetailVO> sc = storeSearch.create();
+    	sc.setParameters("store", storeId);
+
+    	List<ImageStoreDetailVO> details = listBy(sc);
+    	Map<String, String> detailsMap = new HashMap<String, String>();
+    	for (ImageStoreDetailVO detail : details) {
+    		detailsMap.put(detail.getName(), detail.getValue());
+    	}
+
+    	return detailsMap;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreVO.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreVO.java b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreVO.java
new file mode 100644
index 0000000..36d05e5
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreVO.java
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cloudstack.storage.image.db;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.TableGenerator;
+
+
+
+import com.cloud.storage.ImageStore;
+import com.cloud.storage.ScopeType;
+import com.cloud.utils.db.GenericDao;
+
+@Entity
+@Table(name = "image_store")
+public class ImageStoreVO implements ImageStore {
+    @Id
+    @TableGenerator(name = "image_store_sq", table = "sequence", pkColumnName = "name", valueColumnName = "value", pkColumnValue = "image_store_seq", allocationSize = 1)
+    @Column(name = "id", nullable = false)
+    private long id;
+
+    @Column(name = "name", nullable = false)
+    private String name;
+
+    @Column(name = "uuid", nullable = false)
+    private String uuid;
+
+    @Column(name = "protocol", nullable = false)
+    private String protocol;
+
+    @Column(name = "url", nullable = false)
+    private String url;
+
+    @Column(name = "image_provider_name", nullable = false)
+    private String providerName;
+
+    @Column(name = "data_center_id")
+    private long dcId;
+
+    @Column(name = "state")
+    @Enumerated(value = EnumType.STRING)
+    private State state;
+
+    @Column(name = "scope")
+    @Enumerated(value = EnumType.STRING)
+    private ScopeType scope;
+
+    @Column(name=GenericDao.CREATED_COLUMN)
+    private Date created;
+
+    @Column(name=GenericDao.REMOVED_COLUMN)
+    private Date removed;
+
+    public long getId() {
+        return this.id;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+    public String getProviderName() {
+        return this.providerName;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public void setProviderName(String provider) {
+        this.providerName = provider;
+    }
+
+    public void setProtocol(String protocol) {
+        this.protocol = protocol;
+    }
+
+    public String getProtocol() {
+        return this.protocol;
+    }
+
+    public void setDataCenterId(long dcId) {
+        this.dcId = dcId;
+    }
+
+    public Long getDataCenterId() {
+        return this.dcId;
+    }
+
+    public ScopeType getScope() {
+        return this.scope;
+    }
+
+    public void setScope(ScopeType scope) {
+        this.scope = scope;
+    }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+
+    public String getUuid() {
+        return this.uuid;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public Date getCreated() {
+        return created;
+    }
+
+    public void setCreated(Date created) {
+        this.created = created;
+    }
+
+    public Date getRemoved() {
+        return removed;
+    }
+
+    public void setRemoved(Date removed) {
+        this.removed = removed;
+    }
+
+    public State getState() {
+        return state;
+    }
+
+    public void setState(State state) {
+        this.state = state;
+    }
+
+
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/engine/storage/src/org/apache/cloudstack/storage/to/ImageDataStoreTO.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/to/ImageDataStoreTO.java b/engine/storage/src/org/apache/cloudstack/storage/to/ImageDataStoreTO.java
deleted file mode 100644
index b1de88f..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/to/ImageDataStoreTO.java
+++ /dev/null
@@ -1,36 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.storage.to;
-
-import org.apache.cloudstack.storage.image.datastore.ImageDataStoreInfo;
-
-public class ImageDataStoreTO {
-    private final String type;
-    private final String uri;
-    public ImageDataStoreTO(ImageDataStoreInfo dataStore) {
-        this.type = dataStore.getType();
-        this.uri = dataStore.getUri();
-    }
-    
-    public String getType() {
-        return this.type;
-    }
-    
-    public String getUri() {
-        return this.uri;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/engine/storage/src/org/apache/cloudstack/storage/to/ImageStoreTO.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/to/ImageStoreTO.java b/engine/storage/src/org/apache/cloudstack/storage/to/ImageStoreTO.java
new file mode 100644
index 0000000..eb6d088
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/to/ImageStoreTO.java
@@ -0,0 +1,36 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.storage.to;
+
+import org.apache.cloudstack.storage.image.datastore.ImageStoreInfo;
+
+public class ImageStoreTO {
+    private final String type;
+    private final String uri;
+    public ImageStoreTO(ImageStoreInfo dataStore) {
+        this.type = dataStore.getType();
+        this.uri = dataStore.getUri();
+    }
+    
+    public String getType() {
+        return this.type;
+    }
+    
+    public String getUri() {
+        return this.uri;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/engine/storage/src/org/apache/cloudstack/storage/to/TemplateTO.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/to/TemplateTO.java b/engine/storage/src/org/apache/cloudstack/storage/to/TemplateTO.java
index bc55ea8..d7b146b 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/to/TemplateTO.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/to/TemplateTO.java
@@ -18,19 +18,19 @@ package org.apache.cloudstack.storage.to;
 
 import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
 import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat;
-import org.apache.cloudstack.storage.image.datastore.ImageDataStoreInfo;
+import org.apache.cloudstack.storage.image.datastore.ImageStoreInfo;
 
 public class TemplateTO {
     private final String path;
     private final String uuid;
     private  DiskFormat diskType;
-    private final ImageDataStoreTO imageDataStore;
+    private final ImageStoreTO imageDataStore;
 
     public TemplateTO(TemplateInfo template) {
         this.path = null;
         this.uuid = template.getUuid();
         //this.diskType = template.getDiskType();
-        this.imageDataStore = new ImageDataStoreTO((ImageDataStoreInfo)template.getDataStore());
+        this.imageDataStore = new ImageStoreTO((ImageStoreInfo)template.getDataStore());
     }
     
     public String getPath() {
@@ -45,7 +45,7 @@ public class TemplateTO {
         return this.diskType;
     }
     
-    public ImageDataStoreTO getImageDataStore() {
+    public ImageStoreTO getImageDataStore() {
         return this.imageDataStore;
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/plugins/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/pom.xml b/plugins/pom.xml
index a4f37bb..1691549 100755
--- a/plugins/pom.xml
+++ b/plugins/pom.xml
@@ -58,6 +58,7 @@
     <module>user-authenticators/sha256salted</module>
     <module>network-elements/dns-notifier</module>
     <module>storage/image/s3</module>
+    <module>storage/image/swift</module>
     <module>storage/image/default</module>
     <module>storage/image/sample</module>    
     <module>storage/volume/solidfire</module>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageDataStoreDriverImpl.java
----------------------------------------------------------------------
diff --git a/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageDataStoreDriverImpl.java b/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageDataStoreDriverImpl.java
deleted file mode 100644
index 1ff395c..0000000
--- a/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageDataStoreDriverImpl.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.datastore.driver;
-
-import java.util.List;
-import java.util.Set;
-
-import javax.inject.Inject;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.CommandResult;
-import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult;
-import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectType;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
-import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
-import org.apache.cloudstack.framework.async.AsyncRpcConext;
-import org.apache.cloudstack.storage.image.ImageDataStoreDriver;
-import org.apache.log4j.Logger;
-
-import com.cloud.agent.AgentManager;
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.DeleteSnapshotBackupCommand;
-import com.cloud.agent.api.storage.DeleteVolumeCommand;
-import com.cloud.agent.api.to.S3TO;
-import com.cloud.agent.api.to.SwiftTO;
-import com.cloud.host.HostVO;
-import com.cloud.host.dao.HostDao;
-import com.cloud.storage.RegisterVolumePayload;
-import com.cloud.storage.Storage.ImageFormat;
-import com.cloud.storage.SnapshotVO;
-import com.cloud.storage.VMTemplateStorageResourceAssoc;
-import com.cloud.storage.VMTemplateVO;
-import com.cloud.storage.VMTemplateZoneVO;
-import com.cloud.storage.VolumeHostVO;
-import com.cloud.storage.VolumeVO;
-import com.cloud.storage.dao.SnapshotDao;
-import com.cloud.storage.dao.VMTemplateDao;
-import com.cloud.storage.dao.VMTemplateHostDao;
-import com.cloud.storage.dao.VMTemplateZoneDao;
-import com.cloud.storage.dao.VolumeDao;
-import com.cloud.storage.dao.VolumeHostDao;
-import com.cloud.storage.download.DownloadMonitor;
-import com.cloud.storage.s3.S3Manager;
-import com.cloud.storage.snapshot.SnapshotManager;
-import com.cloud.storage.swift.SwiftManager;
-import com.cloud.utils.exception.CloudRuntimeException;
-
-public class CloudStackImageDataStoreDriverImpl implements ImageDataStoreDriver {
-    private static final Logger s_logger = Logger
-            .getLogger(CloudStackImageDataStoreDriverImpl.class);
-    @Inject
-    VMTemplateZoneDao templateZoneDao;
-    @Inject
-    VMTemplateDao templateDao;
-    @Inject DownloadMonitor _downloadMonitor;
-    @Inject 
-    VMTemplateHostDao _vmTemplateHostDao;
-    @Inject VolumeDao volumeDao;
-    @Inject VolumeHostDao volumeHostDao;
-    @Inject HostDao hostDao;
-    @Inject SnapshotDao snapshotDao;
-    @Inject AgentManager agentMgr;
-    @Inject SnapshotManager snapshotMgr;
-	@Inject
-    private SwiftManager _swiftMgr;
-    @Inject 
-    private S3Manager _s3Mgr; 
-    @Override
-    public String grantAccess(DataObject data, EndPoint ep) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public boolean revokeAccess(DataObject data, EndPoint ep) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public Set<DataObject> listObjects(DataStore store) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    class CreateContext<T> extends AsyncRpcConext<T> {
-        final DataObject data;
-        public CreateContext(AsyncCompletionCallback<T> callback, DataObject data) {
-            super(callback);
-            this.data = data;
-        }
-    }
-    
-    @Override
-    public void createAsync(DataObject data,
-            AsyncCompletionCallback<CreateCmdResult> callback) {
-        if (data.getType() == DataObjectType.TEMPLATE) {
-            List<VMTemplateZoneVO> templateZones = this.templateZoneDao.listByTemplateId(data.getId());
-            for (VMTemplateZoneVO templateZone : templateZones) {
-                VMTemplateVO template = this.templateDao.findById(data.getId());
-                _downloadMonitor.downloadTemplateToStorage(template, templateZone.getZoneId());
-            }
-        } else if (data.getType() == DataObjectType.VOLUME) {
-            VolumeVO vol = this.volumeDao.findById(data.getId());
-            VolumeInfo volInfo = (VolumeInfo)data;
-            RegisterVolumePayload payload = (RegisterVolumePayload)volInfo.getpayload();
-            _downloadMonitor.downloadVolumeToStorage(vol, vol.getDataCenterId(), payload.getUrl(),
-                    payload.getChecksum(), ImageFormat.valueOf(payload.getFormat().toUpperCase()));
-        }
-
-        CreateCmdResult result = new CreateCmdResult(null, null);
-        callback.complete(result);
-    }
-    
-    private void deleteVolume(DataObject data, AsyncCompletionCallback<CommandResult> callback) {
-        // TODO Auto-generated method stub
-        VolumeVO vol = volumeDao.findById(data.getId());
-        if (s_logger.isDebugEnabled()) {
-            s_logger.debug("Expunging " + vol);
-        }
-
-        // Find out if the volume is present on secondary storage
-        VolumeHostVO volumeHost = volumeHostDao.findByVolumeId(vol.getId());
-        if (volumeHost != null) {
-            if (volumeHost.getDownloadState() == VMTemplateStorageResourceAssoc.Status.DOWNLOADED) {
-                HostVO ssHost = hostDao.findById(volumeHost.getHostId());
-                DeleteVolumeCommand dtCommand = new DeleteVolumeCommand(
-                        ssHost.getStorageUrl(), volumeHost.getInstallPath());
-                Answer answer = agentMgr.sendToSecStorage(ssHost, dtCommand);
-                if (answer == null || !answer.getResult()) {
-                    s_logger.debug("Failed to delete "
-                            + volumeHost
-                            + " due to "
-                            + ((answer == null) ? "answer is null" : answer
-                                    .getDetails()));
-                    return;
-                }
-            } else if (volumeHost.getDownloadState() == VMTemplateStorageResourceAssoc.Status.DOWNLOAD_IN_PROGRESS) {
-                s_logger.debug("Volume: " + vol.getName()
-                        + " is currently being uploaded; cant' delete it.");
-                throw new CloudRuntimeException(
-                        "Please specify a volume that is not currently being uploaded.");
-            }
-            volumeHostDao.remove(volumeHost.getId());
-            volumeDao.remove(vol.getId());
-            CommandResult result = new CommandResult();
-            callback.complete(result);
-            return;
-        }
-    }
-    
-    private void deleteTemplate(DataObject data, AsyncCompletionCallback<CommandResult> callback) {
-        
-    }
-    
-    private void deleteSnapshot(DataObject data, AsyncCompletionCallback<CommandResult> callback) {
-    	Long snapshotId = data.getId();
-    	SnapshotVO snapshot = this.snapshotDao.findByIdIncludingRemoved(snapshotId);
-    	CommandResult result = new CommandResult();
-    	if (snapshot == null) {
-    		s_logger.debug("Destroying snapshot " + snapshotId + " backup failed due to unable to find snapshot ");
-    		result.setResult("Unable to find snapshot: " + snapshotId);
-    		callback.complete(result);
-    		return;
-    	}
-
-    	try {
-    		String secondaryStoragePoolUrl = this.snapshotMgr.getSecondaryStorageURL(snapshot);
-    		Long dcId = snapshot.getDataCenterId();
-    		Long accountId = snapshot.getAccountId();
-    		Long volumeId = snapshot.getVolumeId();
-
-    		String backupOfSnapshot = snapshot.getBackupSnapshotId();
-    		if (backupOfSnapshot == null) {
-    			callback.complete(result);
-    			return;
-    		}
-    		SwiftTO swift = _swiftMgr.getSwiftTO(snapshot.getSwiftId());
-    		S3TO s3 = _s3Mgr.getS3TO();
-
-    		DeleteSnapshotBackupCommand cmd = new DeleteSnapshotBackupCommand(
-    				swift, s3, secondaryStoragePoolUrl, dcId, accountId, volumeId,
-    				backupOfSnapshot, false);
-    		Answer answer = agentMgr.sendToSSVM(dcId, cmd);
-
-    		if ((answer != null) && answer.getResult()) {
-    			snapshot.setBackupSnapshotId(null);
-    			snapshotDao.update(snapshotId, snapshot);
-    		} else if (answer != null) {
-    			result.setResult(answer.getDetails());
-    		}
-    	} catch (Exception e) {
-    		s_logger.debug("failed to delete snapshot: " + snapshotId + ": " + e.toString());
-    		result.setResult(e.toString());
-    	}
-    	callback.complete(result);
-    }
-    
-    @Override
-    public void deleteAsync(DataObject data,
-            AsyncCompletionCallback<CommandResult> callback) {
-        if (data.getType() == DataObjectType.VOLUME) {
-            deleteVolume(data, callback);
-        } else if (data.getType() == DataObjectType.TEMPLATE) {
-            deleteTemplate(data, callback);
-        } else if (data.getType() == DataObjectType.SNAPSHOT) {
-        	deleteSnapshot(data, callback);
-        }
-    }
-
-    @Override
-    public void copyAsync(DataObject srcdata, DataObject destData,
-            AsyncCompletionCallback<CopyCommandResult> callback) {
-        // TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public boolean canCopy(DataObject srcData, DataObject destData) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-	@Override
-	public void resize(DataObject data,
-			AsyncCompletionCallback<CreateCmdResult> callback) {
-		// TODO Auto-generated method stub
-		
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
----------------------------------------------------------------------
diff --git a/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java b/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
new file mode 100644
index 0000000..e55f0d7
--- /dev/null
+++ b/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
@@ -0,0 +1,250 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cloudstack.storage.datastore.driver;
+
+import java.util.List;
+import java.util.Set;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.engine.subsystem.api.storage.CommandResult;
+import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult;
+import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectType;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
+import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
+import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
+import org.apache.cloudstack.framework.async.AsyncRpcConext;
+import org.apache.cloudstack.storage.image.ImageStoreDriver;
+import org.apache.log4j.Logger;
+
+import com.cloud.agent.AgentManager;
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.DeleteSnapshotBackupCommand;
+import com.cloud.agent.api.storage.DeleteVolumeCommand;
+import com.cloud.agent.api.to.S3TO;
+import com.cloud.agent.api.to.SwiftTO;
+import com.cloud.host.HostVO;
+import com.cloud.host.dao.HostDao;
+import com.cloud.storage.RegisterVolumePayload;
+import com.cloud.storage.Storage.ImageFormat;
+import com.cloud.storage.SnapshotVO;
+import com.cloud.storage.VMTemplateStorageResourceAssoc;
+import com.cloud.storage.VMTemplateVO;
+import com.cloud.storage.VMTemplateZoneVO;
+import com.cloud.storage.VolumeHostVO;
+import com.cloud.storage.VolumeVO;
+import com.cloud.storage.dao.SnapshotDao;
+import com.cloud.storage.dao.VMTemplateDao;
+import com.cloud.storage.dao.VMTemplateHostDao;
+import com.cloud.storage.dao.VMTemplateZoneDao;
+import com.cloud.storage.dao.VolumeDao;
+import com.cloud.storage.dao.VolumeHostDao;
+import com.cloud.storage.download.DownloadMonitor;
+import com.cloud.storage.s3.S3Manager;
+import com.cloud.storage.snapshot.SnapshotManager;
+import com.cloud.storage.swift.SwiftManager;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+public class CloudStackImageStoreDriverImpl implements ImageStoreDriver {
+    private static final Logger s_logger = Logger
+            .getLogger(CloudStackImageStoreDriverImpl.class);
+    @Inject
+    VMTemplateZoneDao templateZoneDao;
+    @Inject
+    VMTemplateDao templateDao;
+    @Inject DownloadMonitor _downloadMonitor;
+    @Inject 
+    VMTemplateHostDao _vmTemplateHostDao;
+    @Inject VolumeDao volumeDao;
+    @Inject VolumeHostDao volumeHostDao;
+    @Inject HostDao hostDao;
+    @Inject SnapshotDao snapshotDao;
+    @Inject AgentManager agentMgr;
+    @Inject SnapshotManager snapshotMgr;
+	@Inject
+    private SwiftManager _swiftMgr;
+    @Inject 
+    private S3Manager _s3Mgr; 
+    @Override
+    public String grantAccess(DataObject data, EndPoint ep) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public boolean revokeAccess(DataObject data, EndPoint ep) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    @Override
+    public Set<DataObject> listObjects(DataStore store) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    class CreateContext<T> extends AsyncRpcConext<T> {
+        final DataObject data;
+        public CreateContext(AsyncCompletionCallback<T> callback, DataObject data) {
+            super(callback);
+            this.data = data;
+        }
+    }
+    
+    @Override
+    public void createAsync(DataObject data,
+            AsyncCompletionCallback<CreateCmdResult> callback) {
+        if (data.getType() == DataObjectType.TEMPLATE) {
+            List<VMTemplateZoneVO> templateZones = this.templateZoneDao.listByTemplateId(data.getId());
+            for (VMTemplateZoneVO templateZone : templateZones) {
+                VMTemplateVO template = this.templateDao.findById(data.getId());
+                _downloadMonitor.downloadTemplateToStorage(template, templateZone.getZoneId());
+            }
+        } else if (data.getType() == DataObjectType.VOLUME) {
+            VolumeVO vol = this.volumeDao.findById(data.getId());
+            VolumeInfo volInfo = (VolumeInfo)data;
+            RegisterVolumePayload payload = (RegisterVolumePayload)volInfo.getpayload();
+            _downloadMonitor.downloadVolumeToStorage(vol, vol.getDataCenterId(), payload.getUrl(),
+                    payload.getChecksum(), ImageFormat.valueOf(payload.getFormat().toUpperCase()));
+        }
+
+        CreateCmdResult result = new CreateCmdResult(null, null);
+        callback.complete(result);
+    }
+    
+    private void deleteVolume(DataObject data, AsyncCompletionCallback<CommandResult> callback) {
+        // TODO Auto-generated method stub
+        VolumeVO vol = volumeDao.findById(data.getId());
+        if (s_logger.isDebugEnabled()) {
+            s_logger.debug("Expunging " + vol);
+        }
+
+        // Find out if the volume is present on secondary storage
+        VolumeHostVO volumeHost = volumeHostDao.findByVolumeId(vol.getId());
+        if (volumeHost != null) {
+            if (volumeHost.getDownloadState() == VMTemplateStorageResourceAssoc.Status.DOWNLOADED) {
+                HostVO ssHost = hostDao.findById(volumeHost.getHostId());
+                DeleteVolumeCommand dtCommand = new DeleteVolumeCommand(
+                        ssHost.getStorageUrl(), volumeHost.getInstallPath());
+                Answer answer = agentMgr.sendToSecStorage(ssHost, dtCommand);
+                if (answer == null || !answer.getResult()) {
+                    s_logger.debug("Failed to delete "
+                            + volumeHost
+                            + " due to "
+                            + ((answer == null) ? "answer is null" : answer
+                                    .getDetails()));
+                    return;
+                }
+            } else if (volumeHost.getDownloadState() == VMTemplateStorageResourceAssoc.Status.DOWNLOAD_IN_PROGRESS) {
+                s_logger.debug("Volume: " + vol.getName()
+                        + " is currently being uploaded; cant' delete it.");
+                throw new CloudRuntimeException(
+                        "Please specify a volume that is not currently being uploaded.");
+            }
+            volumeHostDao.remove(volumeHost.getId());
+            volumeDao.remove(vol.getId());
+            CommandResult result = new CommandResult();
+            callback.complete(result);
+            return;
+        }
+    }
+    
+    private void deleteTemplate(DataObject data, AsyncCompletionCallback<CommandResult> callback) {
+        
+    }
+    
+    private void deleteSnapshot(DataObject data, AsyncCompletionCallback<CommandResult> callback) {
+    	Long snapshotId = data.getId();
+    	SnapshotVO snapshot = this.snapshotDao.findByIdIncludingRemoved(snapshotId);
+    	CommandResult result = new CommandResult();
+    	if (snapshot == null) {
+    		s_logger.debug("Destroying snapshot " + snapshotId + " backup failed due to unable to find snapshot ");
+    		result.setResult("Unable to find snapshot: " + snapshotId);
+    		callback.complete(result);
+    		return;
+    	}
+
+    	try {
+    		String secondaryStoragePoolUrl = this.snapshotMgr.getSecondaryStorageURL(snapshot);
+    		Long dcId = snapshot.getDataCenterId();
+    		Long accountId = snapshot.getAccountId();
+    		Long volumeId = snapshot.getVolumeId();
+
+    		String backupOfSnapshot = snapshot.getBackupSnapshotId();
+    		if (backupOfSnapshot == null) {
+    			callback.complete(result);
+    			return;
+    		}
+    		SwiftTO swift = _swiftMgr.getSwiftTO(snapshot.getSwiftId());
+    		S3TO s3 = _s3Mgr.getS3TO();
+
+    		DeleteSnapshotBackupCommand cmd = new DeleteSnapshotBackupCommand(
+    				swift, s3, secondaryStoragePoolUrl, dcId, accountId, volumeId,
+    				backupOfSnapshot, false);
+    		Answer answer = agentMgr.sendToSSVM(dcId, cmd);
+
+    		if ((answer != null) && answer.getResult()) {
+    			snapshot.setBackupSnapshotId(null);
+    			snapshotDao.update(snapshotId, snapshot);
+    		} else if (answer != null) {
+    			result.setResult(answer.getDetails());
+    		}
+    	} catch (Exception e) {
+    		s_logger.debug("failed to delete snapshot: " + snapshotId + ": " + e.toString());
+    		result.setResult(e.toString());
+    	}
+    	callback.complete(result);
+    }
+    
+    @Override
+    public void deleteAsync(DataObject data,
+            AsyncCompletionCallback<CommandResult> callback) {
+        if (data.getType() == DataObjectType.VOLUME) {
+            deleteVolume(data, callback);
+        } else if (data.getType() == DataObjectType.TEMPLATE) {
+            deleteTemplate(data, callback);
+        } else if (data.getType() == DataObjectType.SNAPSHOT) {
+        	deleteSnapshot(data, callback);
+        }
+    }
+
+    @Override
+    public void copyAsync(DataObject srcdata, DataObject destData,
+            AsyncCompletionCallback<CopyCommandResult> callback) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    public boolean canCopy(DataObject srcData, DataObject destData) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+	@Override
+	public void resize(DataObject data,
+			AsyncCompletionCallback<CreateCmdResult> callback) {
+		// TODO Auto-generated method stub
+		
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackImageDataStoreLifeCycle.java
----------------------------------------------------------------------
diff --git a/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackImageDataStoreLifeCycle.java b/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackImageDataStoreLifeCycle.java
deleted file mode 100644
index f111dfa..0000000
--- a/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackImageDataStoreLifeCycle.java
+++ /dev/null
@@ -1,178 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.storage.datastore.lifecycle;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.inject.Inject;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.HostScope;
-import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
-import org.apache.cloudstack.storage.image.datastore.ImageDataStoreHelper;
-import org.apache.cloudstack.storage.image.datastore.ImageDataStoreProviderManager;
-import org.apache.cloudstack.storage.image.db.ImageDataStoreDao;
-import org.apache.cloudstack.storage.image.db.ImageDataStoreVO;
-import org.apache.cloudstack.storage.image.store.lifecycle.ImageDataStoreLifeCycle;
-import org.apache.log4j.Logger;
-
-import com.cloud.agent.api.StoragePoolInfo;
-import com.cloud.exception.DiscoveryException;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.host.Host;
-import com.cloud.host.HostVO;
-import com.cloud.hypervisor.kvm.discoverer.KvmDummyResourceBase;
-import com.cloud.resource.Discoverer;
-import com.cloud.resource.ResourceListener;
-import com.cloud.resource.ResourceManager;
-import com.cloud.resource.ServerResource;
-import com.cloud.storage.ScopeType;
-import com.cloud.utils.UriUtils;
-
-public class CloudStackImageDataStoreLifeCycle implements ImageDataStoreLifeCycle {
-
-    private static final Logger s_logger = Logger
-            .getLogger(CloudStackImageDataStoreLifeCycle.class);
-    @Inject
-    protected ResourceManager _resourceMgr;
-    @Inject
-	protected ImageDataStoreDao imageStoreDao;
-	@Inject
-	ImageDataStoreHelper imageStoreHelper;
-	@Inject
-	ImageDataStoreProviderManager imageStoreMgr;
-
-    protected List<? extends Discoverer> _discoverers;
-    public List<? extends Discoverer> getDiscoverers() {
-        return _discoverers;
-    }
-    public void setDiscoverers(List<? extends Discoverer> _discoverers) {
-        this._discoverers = _discoverers;
-    }
-
-	public CloudStackImageDataStoreLifeCycle() {
-	}
-
-
-    @Override
-    public DataStore initialize(Map<String, Object> dsInfos) {
-
-        Long dcId = (Long) dsInfos.get("zoneId");
-        String url = (String) dsInfos.get("url");
-        String providerName = (String)dsInfos.get("providerName");
-
-        s_logger.info("Trying to add a new host at " + url + " in data center " + dcId);
-
-        URI uri = null;
-        try {
-            uri = new URI(UriUtils.encodeURIComponent(url));
-            if (uri.getScheme() == null) {
-                throw new InvalidParameterValueException("uri.scheme is null "
-                        + url + ", add nfs:// as a prefix");
-            } else if (uri.getScheme().equalsIgnoreCase("nfs")) {
-                if (uri.getHost() == null || uri.getHost().equalsIgnoreCase("")
-                        || uri.getPath() == null
-                        || uri.getPath().equalsIgnoreCase("")) {
-                    throw new InvalidParameterValueException(
-                            "Your host and/or path is wrong.  Make sure it's of the format nfs://hostname/path");
-                }
-            }
-        } catch (URISyntaxException e) {
-            throw new InvalidParameterValueException(url
-                    + " is not a valid uri");
-        }
-
-        if ( dcId == null ){
-            throw new InvalidParameterValueException("DataCenter id is null, and cloudstack default image storehas to be associated with a data center");
-        }
-
-
-        Map<String, Object> imageStoreParameters = new HashMap<String, Object>();
-        imageStoreParameters.put("name", url);
-        imageStoreParameters.put("zoneId", dcId);
-        imageStoreParameters.put("url", url);
-        imageStoreParameters.put("protocol", uri.getScheme().toLowerCase());
-        imageStoreParameters.put("scope", ScopeType.ZONE);
-        imageStoreParameters.put("providerName", providerName);
-
-        ImageDataStoreVO ids = imageStoreHelper.createImageDataStore(imageStoreParameters);
-        return imageStoreMgr.getImageDataStore(ids.getId());
-    }
-
-
-    @Override
-    public boolean attachCluster(DataStore store, ClusterScope scope) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-
-    @Override
-    public boolean attachHost(DataStore store, HostScope scope,
-            StoragePoolInfo existingInfo) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-
-    @Override
-    public boolean attachZone(DataStore dataStore, ZoneScope scope) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-
-    @Override
-    public boolean dettach() {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-
-    @Override
-    public boolean unmanaged() {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-
-    @Override
-    public boolean maintain(DataStore store) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-
-    @Override
-    public boolean cancelMaintain(DataStore store) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-
-    @Override
-    public boolean deleteDataStore(DataStore store) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a872d6d3/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackImageStoreLifeCycleImpl.java
----------------------------------------------------------------------
diff --git a/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackImageStoreLifeCycleImpl.java b/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackImageStoreLifeCycleImpl.java
new file mode 100644
index 0000000..fbd9909
--- /dev/null
+++ b/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackImageStoreLifeCycleImpl.java
@@ -0,0 +1,179 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.storage.datastore.lifecycle;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.engine.subsystem.api.storage.HostScope;
+import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
+import org.apache.cloudstack.storage.image.datastore.ImageStoreHelper;
+import org.apache.cloudstack.storage.image.datastore.ImageStoreProviderManager;
+import org.apache.cloudstack.storage.image.db.ImageStoreDao;
+import org.apache.cloudstack.storage.image.db.ImageStoreVO;
+import org.apache.cloudstack.storage.image.store.lifecycle.ImageStoreLifeCycle;
+import org.apache.log4j.Logger;
+
+import com.cloud.agent.api.StoragePoolInfo;
+import com.cloud.exception.DiscoveryException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.host.Host;
+import com.cloud.host.HostVO;
+import com.cloud.hypervisor.kvm.discoverer.KvmDummyResourceBase;
+import com.cloud.resource.Discoverer;
+import com.cloud.resource.ResourceListener;
+import com.cloud.resource.ResourceManager;
+import com.cloud.resource.ServerResource;
+import com.cloud.storage.ScopeType;
+import com.cloud.utils.UriUtils;
+
+public class CloudStackImageStoreLifeCycleImpl implements ImageStoreLifeCycle {
+
+    private static final Logger s_logger = Logger
+            .getLogger(CloudStackImageStoreLifeCycleImpl.class);
+    @Inject
+    protected ResourceManager _resourceMgr;
+    @Inject
+	protected ImageStoreDao imageStoreDao;
+	@Inject
+	ImageStoreHelper imageStoreHelper;
+	@Inject
+	ImageStoreProviderManager imageStoreMgr;
+
+    protected List<? extends Discoverer> _discoverers;
+    public List<? extends Discoverer> getDiscoverers() {
+        return _discoverers;
+    }
+    public void setDiscoverers(List<? extends Discoverer> _discoverers) {
+        this._discoverers = _discoverers;
+    }
+
+	public CloudStackImageStoreLifeCycleImpl() {
+	}
+
+
+    @Override
+    public DataStore initialize(Map<String, Object> dsInfos) {
+
+        Long dcId = (Long) dsInfos.get("zoneId");
+        String url = (String) dsInfos.get("url");
+        String providerName = (String)dsInfos.get("providerName");
+        Map<String, String> details = (Map<String, String>)dsInfos.get("details");
+
+        s_logger.info("Trying to add a new host at " + url + " in data center " + dcId);
+
+        URI uri = null;
+        try {
+            uri = new URI(UriUtils.encodeURIComponent(url));
+            if (uri.getScheme() == null) {
+                throw new InvalidParameterValueException("uri.scheme is null "
+                        + url + ", add nfs:// as a prefix");
+            } else if (uri.getScheme().equalsIgnoreCase("nfs")) {
+                if (uri.getHost() == null || uri.getHost().equalsIgnoreCase("")
+                        || uri.getPath() == null
+                        || uri.getPath().equalsIgnoreCase("")) {
+                    throw new InvalidParameterValueException(
+                            "Your host and/or path is wrong.  Make sure it's of the format nfs://hostname/path");
+                }
+            }
+        } catch (URISyntaxException e) {
+            throw new InvalidParameterValueException(url
+                    + " is not a valid uri");
+        }
+
+        if ( dcId == null ){
+            throw new InvalidParameterValueException("DataCenter id is null, and cloudstack default image storehas to be associated with a data center");
+        }
+
+
+        Map<String, Object> imageStoreParameters = new HashMap<String, Object>();
+        imageStoreParameters.put("name", url);
+        imageStoreParameters.put("zoneId", dcId);
+        imageStoreParameters.put("url", url);
+        imageStoreParameters.put("protocol", uri.getScheme().toLowerCase());
+        imageStoreParameters.put("scope", ScopeType.ZONE);  // default cloudstack provider only supports zone-wide image store
+        imageStoreParameters.put("providerName", providerName);
+
+        ImageStoreVO ids = imageStoreHelper.createImageStore(imageStoreParameters, details);
+        return imageStoreMgr.getImageStore(ids.getId());
+    }
+
+
+    @Override
+    public boolean attachCluster(DataStore store, ClusterScope scope) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+
+    @Override
+    public boolean attachHost(DataStore store, HostScope scope,
+            StoragePoolInfo existingInfo) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+
+    @Override
+    public boolean attachZone(DataStore dataStore, ZoneScope scope) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+
+    @Override
+    public boolean dettach() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+
+    @Override
+    public boolean unmanaged() {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+
+    @Override
+    public boolean maintain(DataStore store) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+
+    @Override
+    public boolean cancelMaintain(DataStore store) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+
+    @Override
+    public boolean deleteDataStore(DataStore store) {
+        // TODO Auto-generated method stub
+        return false;
+    }
+}


Mime
View raw message