|
23 | 23 | import org.apache.cloudstack.engine.subsystem.api.storage.CommandResult; |
24 | 24 | import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult; |
25 | 25 | import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult; |
26 | | -import org.apache.cloudstack.engine.subsystem.api.storage.DataStream; |
| 26 | +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; |
| 27 | +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectType; |
27 | 28 | import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; |
28 | 29 | import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint; |
29 | 30 | import org.apache.cloudstack.framework.async.AsyncCompletionCallback; |
30 | 31 | import org.apache.cloudstack.storage.image.ImageDataStoreDriver; |
31 | 32 |
|
| 33 | +//http-read-only based image store |
32 | 34 | public class DefaultImageDataStoreDriverImpl implements ImageDataStoreDriver { |
33 | 35 |
|
34 | 36 | public DefaultImageDataStoreDriverImpl() { |
35 | 37 | } |
36 | 38 |
|
37 | 39 | @Override |
38 | | - public String grantAccess(DataStream data, EndPoint ep) { |
39 | | - // TODO Auto-generated method stub |
40 | | - return null; |
| 40 | + public String grantAccess(DataObject data, EndPoint ep) { |
| 41 | + return data.getUri(); |
41 | 42 | } |
42 | 43 |
|
43 | 44 | @Override |
44 | | - public boolean revokeAccess(DataStream data, EndPoint ep) { |
| 45 | + public boolean revokeAccess(DataObject data, EndPoint ep) { |
45 | 46 | // TODO Auto-generated method stub |
46 | | - return false; |
| 47 | + return true; |
47 | 48 | } |
48 | 49 |
|
49 | 50 | @Override |
50 | | - public Set<DataStream> listObjects(DataStore store) { |
| 51 | + public Set<DataObject> listObjects(DataStore store) { |
51 | 52 | // TODO Auto-generated method stub |
52 | 53 | return null; |
53 | 54 | } |
54 | 55 |
|
55 | 56 | @Override |
56 | | - public void createAsync(DataStream data, |
| 57 | + public void createAsync(DataObject data, |
57 | 58 | AsyncCompletionCallback<CreateCmdResult> callback) { |
58 | | - // TODO Auto-generated method stub |
| 59 | + //for default http data store, can create http based template/iso |
| 60 | + CreateCmdResult result = new CreateCmdResult(""); |
| 61 | + if (!data.getUri().startsWith("http")) { |
| 62 | + result.setResult("can't register an image which is not a http link"); |
| 63 | + callback.complete(result); |
| 64 | + } |
59 | 65 |
|
| 66 | + callback.complete(result); |
60 | 67 | } |
61 | 68 |
|
62 | 69 | @Override |
63 | | - public void deleteAsync(DataStream data, |
| 70 | + public void deleteAsync(DataObject data, |
64 | 71 | AsyncCompletionCallback<CommandResult> callback) { |
65 | | - // TODO Auto-generated method stub |
66 | | - |
| 72 | + CommandResult result = new CommandResult(); |
| 73 | + callback.complete(result); |
67 | 74 | } |
68 | 75 |
|
69 | 76 | @Override |
70 | | - public boolean canCopy(DataStream srcData, DataStream destData) { |
| 77 | + public boolean canCopy(DataObject srcData, DataObject destData) { |
71 | 78 | // TODO Auto-generated method stub |
72 | 79 | return false; |
73 | 80 | } |
74 | 81 |
|
75 | 82 | @Override |
76 | | - public void copyAsync(DataStream srcdata, DataStream destData, |
| 83 | + public void copyAsync(DataObject srcdata, DataObject destData, |
77 | 84 | AsyncCompletionCallback<CopyCommandResult> callback) { |
78 | 85 | // TODO Auto-generated method stub |
79 | 86 |
|
|
0 commit comments