Updated Branches:
  refs/heads/javelin 37c95dd11 -> 7c9e30a6e

add more files


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/7c9e30a6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/7c9e30a6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/7c9e30a6

Branch: refs/heads/javelin
Commit: 7c9e30a6ea2de0880cebec401f5e28799d77c2a8
Parents: 37c95dd
Author: Edison Su <[email protected]>
Authored: Fri Nov 2 17:44:28 2012 -0700
Committer: Edison Su <[email protected]>
Committed: Fri Nov 2 17:44:28 2012 -0700

----------------------------------------------------------------------
 .../platform/subsystem/api/storage/Template.java   |   23 ------
 .../cloudstack/storage/image/ImageService.java     |    2 +-
 .../cloudstack/storage/image/ImageServiceImpl.java |   19 ++++-
 .../apache/cloudstack/storage/image/Template.java  |    7 ++
 .../storage/image/db/ImageDaoStoreDao.java         |   25 ++++++
 .../storage/image/db/ImageDaoStoreDaoImpl.java     |   25 ++++++
 .../image/db/ImageDataStoreProviderDao.java        |   25 ++++++
 .../image/db/ImageDataStoreProviderDaoImpl.java    |   26 ++++++
 .../storage/image/db/ImageDataStoreProviderVO.java |   23 ++++++
 .../storage/image/db/ImageDataStoreVO.java         |   60 +++++++++++++++
 .../storage/image/downloader/ImageDownloader.java  |   25 ++++++
 .../image/driver/ImageDataStoreDriverImpl.java     |    4 +-
 .../image/manager/ImageDataStoreManagerImpl.java   |   12 +++-
 .../provider/ImageDataStoreProviderManager.java    |   23 ++++++
 .../ImageDataStoreProviderManagerImpl.java         |   37 +++++++++
 .../storage/image/store/ImageDataStore.java        |    3 +
 .../storage/image/store/ImageDataStoreImpl.java    |   40 +++++++++-
 17 files changed, 346 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7c9e30a6/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/Template.java
----------------------------------------------------------------------
diff --git 
a/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/Template.java
 
b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/Template.java
deleted file mode 100644
index efa7538..0000000
--- 
a/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/Template.java
+++ /dev/null
@@ -1,23 +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.platform.subsystem.api.storage;
-
-public interface Template extends DataObject {
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7c9e30a6/platform/storage/src/org/apache/cloudstack/storage/image/ImageService.java
----------------------------------------------------------------------
diff --git 
a/platform/storage/src/org/apache/cloudstack/storage/image/ImageService.java 
b/platform/storage/src/org/apache/cloudstack/storage/image/ImageService.java
index 3ff020e..ebdc594 100644
--- a/platform/storage/src/org/apache/cloudstack/storage/image/ImageService.java
+++ b/platform/storage/src/org/apache/cloudstack/storage/image/ImageService.java
@@ -19,7 +19,7 @@
 package org.apache.cloudstack.storage.image;
 
 public interface ImageService {
-       long registerTemplate(String templateUrl, long accountId);
+       boolean registerTemplate(long templateId, long imageStoreId);
        boolean deleteTemplate(long templateId);
        long registerIso(String isoUrl, long accountId);
        boolean deleteIso(long isoId);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7c9e30a6/platform/storage/src/org/apache/cloudstack/storage/image/ImageServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/platform/storage/src/org/apache/cloudstack/storage/image/ImageServiceImpl.java
 
b/platform/storage/src/org/apache/cloudstack/storage/image/ImageServiceImpl.java
index 119a255..6849192 100644
--- 
a/platform/storage/src/org/apache/cloudstack/storage/image/ImageServiceImpl.java
+++ 
b/platform/storage/src/org/apache/cloudstack/storage/image/ImageServiceImpl.java
@@ -18,12 +18,25 @@
  */
 package org.apache.cloudstack.storage.image;
 
+import javax.inject.Inject;
+
+import org.apache.cloudstack.storage.image.downloader.ImageDownloader;
+import org.apache.cloudstack.storage.image.manager.ImageDataStoreManager;
+import org.apache.cloudstack.storage.image.store.ImageDataStore;
+
 public class ImageServiceImpl implements ImageService {
 
+       @Inject
+       ImageDataStoreManager imageStoreMgr;
        @Override
-       public long registerTemplate(String templateUrl, long accountId) {
-               // TODO Auto-generated method stub
-               return 0;
+       public boolean registerTemplate(long templateId, long imageStoreId) {
+               ImageDataStore ids = 
imageStoreMgr.getImageDataStore(imageStoreId);
+               Template template = ids.registerTemplate(templateId);
+               if (ids.needDownloadToCacheStorage()) {
+                       ImageDownloader imageDl = ids.getImageDownloader();
+                       imageDl.downloadImage(template);
+               }
+               return true;
        }
 
        @Override

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7c9e30a6/platform/storage/src/org/apache/cloudstack/storage/image/Template.java
----------------------------------------------------------------------
diff --git 
a/platform/storage/src/org/apache/cloudstack/storage/image/Template.java 
b/platform/storage/src/org/apache/cloudstack/storage/image/Template.java
index 8191550..4fc6b53 100644
--- a/platform/storage/src/org/apache/cloudstack/storage/image/Template.java
+++ b/platform/storage/src/org/apache/cloudstack/storage/image/Template.java
@@ -28,4 +28,11 @@ public class Template {
                this.dataStore = dataStore;
                this.imageVO = imageVO;
        }
+       
+       public ImageDataStore getImageDataStore() {
+               return this.dataStore;
+       }
+       
+       public String getTemplate
+       
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7c9e30a6/platform/storage/src/org/apache/cloudstack/storage/image/db/ImageDaoStoreDao.java
----------------------------------------------------------------------
diff --git 
a/platform/storage/src/org/apache/cloudstack/storage/image/db/ImageDaoStoreDao.java
 
b/platform/storage/src/org/apache/cloudstack/storage/image/db/ImageDaoStoreDao.java
new file mode 100644
index 0000000..3e1a951
--- /dev/null
+++ 
b/platform/storage/src/org/apache/cloudstack/storage/image/db/ImageDaoStoreDao.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 ImageDaoStoreDao extends GenericDao<ImageDataStoreVO, Long> {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7c9e30a6/platform/storage/src/org/apache/cloudstack/storage/image/db/ImageDaoStoreDaoImpl.java
----------------------------------------------------------------------
diff --git 
a/platform/storage/src/org/apache/cloudstack/storage/image/db/ImageDaoStoreDaoImpl.java
 
b/platform/storage/src/org/apache/cloudstack/storage/image/db/ImageDaoStoreDaoImpl.java
new file mode 100644
index 0000000..01dd62e
--- /dev/null
+++ 
b/platform/storage/src/org/apache/cloudstack/storage/image/db/ImageDaoStoreDaoImpl.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.GenericDaoBase;
+
+public class ImageDaoStoreDaoImpl extends GenericDaoBase<ImageDataStoreVO, 
Long> implements ImageDaoStoreDao {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7c9e30a6/platform/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderDao.java
----------------------------------------------------------------------
diff --git 
a/platform/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderDao.java
 
b/platform/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderDao.java
new file mode 100644
index 0000000..466afa2
--- /dev/null
+++ 
b/platform/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderDao.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 ImageDataStoreProviderDao extends 
GenericDao<ImageDataStoreProviderVO, Long> {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7c9e30a6/platform/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderDaoImpl.java
----------------------------------------------------------------------
diff --git 
a/platform/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderDaoImpl.java
 
b/platform/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderDaoImpl.java
new file mode 100644
index 0000000..cb075be
--- /dev/null
+++ 
b/platform/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderDaoImpl.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.db;
+
+import com.cloud.utils.db.GenericDaoBase;
+
+
+public class ImageDataStoreProviderDaoImpl extends 
GenericDaoBase<ImageDataStoreProviderVO, Long> implements 
ImageDataStoreProviderDao {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7c9e30a6/platform/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderVO.java
----------------------------------------------------------------------
diff --git 
a/platform/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderVO.java
 
b/platform/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderVO.java
new file mode 100644
index 0000000..b8ecdcc
--- /dev/null
+++ 
b/platform/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderVO.java
@@ -0,0 +1,23 @@
+/*
+ * 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;
+
+public interface ImageDataStoreProviderVO {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7c9e30a6/platform/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreVO.java
----------------------------------------------------------------------
diff --git 
a/platform/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreVO.java
 
b/platform/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreVO.java
new file mode 100644
index 0000000..7177203
--- /dev/null
+++ 
b/platform/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreVO.java
@@ -0,0 +1,60 @@
+/*
+ * 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")
+public class ImageDataStoreVO {
+    @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="image_provider", nullable = false)
+    private long provider;
+    
+    public long getId() {
+       return this.id;
+    }
+    
+    public String getName() {
+       return this.name;
+    }
+    
+    public long getProvider() {
+       return this.provider;
+    }
+    
+    public void setName(String name) {
+       this.name = name;
+    }
+    
+    public void setProvider(long provider) {
+       this.provider = provider;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7c9e30a6/platform/storage/src/org/apache/cloudstack/storage/image/downloader/ImageDownloader.java
----------------------------------------------------------------------
diff --git 
a/platform/storage/src/org/apache/cloudstack/storage/image/downloader/ImageDownloader.java
 
b/platform/storage/src/org/apache/cloudstack/storage/image/downloader/ImageDownloader.java
new file mode 100644
index 0000000..123df61
--- /dev/null
+++ 
b/platform/storage/src/org/apache/cloudstack/storage/image/downloader/ImageDownloader.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.downloader;
+
+import org.apache.cloudstack.storage.image.Template;
+
+public interface ImageDownloader {
+       public void downloadImage(Template template);
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7c9e30a6/platform/storage/src/org/apache/cloudstack/storage/image/driver/ImageDataStoreDriverImpl.java
----------------------------------------------------------------------
diff --git 
a/platform/storage/src/org/apache/cloudstack/storage/image/driver/ImageDataStoreDriverImpl.java
 
b/platform/storage/src/org/apache/cloudstack/storage/image/driver/ImageDataStoreDriverImpl.java
index 55a8920..a88e669 100644
--- 
a/platform/storage/src/org/apache/cloudstack/storage/image/driver/ImageDataStoreDriverImpl.java
+++ 
b/platform/storage/src/org/apache/cloudstack/storage/image/driver/ImageDataStoreDriverImpl.java
@@ -24,8 +24,8 @@ public class ImageDataStoreDriverImpl implements 
ImageDataStoreDriver {
 
        @Override
        public boolean registerTemplate(Template template) {
-               // TODO Auto-generated method stub
-               return false;
+               //TODO: check the availability of template 
+               return true;
        }
 
        @Override

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7c9e30a6/platform/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManagerImpl.java
----------------------------------------------------------------------
diff --git 
a/platform/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManagerImpl.java
 
b/platform/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManagerImpl.java
index 6f8a58f..3b09fcb 100644
--- 
a/platform/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManagerImpl.java
+++ 
b/platform/storage/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManagerImpl.java
@@ -18,12 +18,22 @@
  */
 package org.apache.cloudstack.storage.image.manager;
 
+import javax.inject.Inject;
+
+import org.apache.cloudstack.storage.datastore.db.DataStoreVO;
+import org.apache.cloudstack.storage.image.db.ImageDaoStoreDao;
+import org.apache.cloudstack.storage.image.db.ImageDataDao;
+import org.apache.cloudstack.storage.image.db.ImageDataStoreVO;
 import org.apache.cloudstack.storage.image.store.ImageDataStore;
 
 public class ImageDataStoreManagerImpl implements ImageDataStoreManager {
-
+       @Inject
+       ImageDaoStoreDao dataStoreDao;
+       @Inject
+       ImageDataDao imageDataDao;
        @Override
        public ImageDataStore getImageDataStore(long dataStoreId) {
+               ImageDataStoreVO dataStore = dataStoreDao.findById(dataStoreId);
                // TODO Auto-generated method stub
                return null;
        }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7c9e30a6/platform/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProviderManager.java
----------------------------------------------------------------------
diff --git 
a/platform/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProviderManager.java
 
b/platform/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProviderManager.java
new file mode 100644
index 0000000..1f9c956
--- /dev/null
+++ 
b/platform/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProviderManager.java
@@ -0,0 +1,23 @@
+/*
+ * 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.provider;
+
+public interface ImageDataStoreProviderManager {
+       public ImageDataStoreProvider getProvider(long providerId);
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7c9e30a6/platform/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProviderManagerImpl.java
----------------------------------------------------------------------
diff --git 
a/platform/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProviderManagerImpl.java
 
b/platform/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProviderManagerImpl.java
new file mode 100644
index 0000000..0325311
--- /dev/null
+++ 
b/platform/storage/src/org/apache/cloudstack/storage/image/provider/ImageDataStoreProviderManagerImpl.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.provider;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.storage.image.db.ImageDataStoreProviderDao;
+
+
+public class ImageDataStoreProviderManagerImpl implements 
ImageDataStoreProviderManager {
+
+       @Inject
+       ImageDataStoreProviderDao providerDao;
+       @Override
+       public ImageDataStoreProvider getProvider(long providerId) {
+               
+               return null;
+       }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7c9e30a6/platform/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStore.java
----------------------------------------------------------------------
diff --git 
a/platform/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStore.java
 
b/platform/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStore.java
index 2faead9..60d1e84 100644
--- 
a/platform/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStore.java
+++ 
b/platform/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStore.java
@@ -19,10 +19,13 @@
 package org.apache.cloudstack.storage.image.store;
 
 import org.apache.cloudstack.storage.image.Template;
+import org.apache.cloudstack.storage.image.downloader.ImageDownloader;
 
 public interface ImageDataStore {
        Template registerTemplate(long templateId);
        String grantAccess(long templateId, long endPointId);
        boolean revokeAccess(long templateId, long endPointId);
        boolean deleteTemplate(long templateId);
+       boolean needDownloadToCacheStorage();
+       ImageDownloader getImageDownloader();
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/7c9e30a6/platform/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStoreImpl.java
----------------------------------------------------------------------
diff --git 
a/platform/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStoreImpl.java
 
b/platform/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStoreImpl.java
index 5986378..925e152 100644
--- 
a/platform/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStoreImpl.java
+++ 
b/platform/storage/src/org/apache/cloudstack/storage/image/store/ImageDataStoreImpl.java
@@ -18,14 +18,37 @@
  */
 package org.apache.cloudstack.storage.image.store;
 
+import javax.inject.Inject;
+
 import org.apache.cloudstack.storage.image.Template;
+import org.apache.cloudstack.storage.image.db.ImageDataDao;
+import org.apache.cloudstack.storage.image.db.ImageDataVO;
+import org.apache.cloudstack.storage.image.downloader.ImageDownloader;
+import org.apache.cloudstack.storage.image.driver.ImageDataStoreDriver;
 
 public class ImageDataStoreImpl implements ImageDataStore {
-
+       @Inject
+       ImageDataDao imageDao;
+       ImageDataStoreDriver driver;
+       ImageDownloader downloader;
+       boolean needDownloadToCacheStorage = false;
+       
+       
+       public ImageDataStoreImpl(ImageDataStoreDriver driver, boolean 
needDownloadToCacheStorage, ImageDownloader downloader) {
+               this.driver = driver;
+               this.needDownloadToCacheStorage = needDownloadToCacheStorage;
+               this.downloader = downloader;
+       }
+       
        @Override
        public Template registerTemplate(long templateId) {
-               // TODO Auto-generated method stub
-               return null;
+               ImageDataVO idv = imageDao.findById(templateId);
+               Template template = new Template(this, idv);
+               if (driver.registerTemplate(template)) {
+                       return template;
+               } else {
+                       return null;
+               }
        }
 
        @Override
@@ -46,4 +69,15 @@ public class ImageDataStoreImpl implements ImageDataStore {
                return false;
        }
 
+       @Override
+       public boolean needDownloadToCacheStorage() {
+               // TODO Auto-generated method stub
+               return false;
+       }
+
+       @Override
+       public ImageDownloader getImageDownloader() {
+               return this.downloader;
+       }
+
 }

Reply via email to