Skip to content

Commit c4a11b9

Browse files
committed
rename datastream to dataobject
1 parent 4ca828c commit c4a11b9

21 files changed

Lines changed: 75 additions & 69 deletions

File tree

engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStream.java renamed to engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataObject.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat;
2222

23-
public interface DataStream {
23+
public interface DataObject {
2424
public long getId();
2525
public String getUri();
2626
public DataStore getDataStore();

engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreDriver.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
2424

2525
public interface DataStoreDriver {
26-
public String grantAccess(DataStream data, EndPoint ep);
27-
public boolean revokeAccess(DataStream data, EndPoint ep);
28-
public Set<DataStream> listObjects(DataStore store);
29-
public void createAsync(DataStream data, AsyncCompletionCallback<CreateCmdResult> callback);
30-
public void deleteAsync(DataStream data, AsyncCompletionCallback<CommandResult> callback);
31-
public void copyAsync(DataStream srcdata, DataStream destData, AsyncCompletionCallback<CopyCommandResult> callback);
32-
public boolean canCopy(DataStream srcData, DataStream destData);
26+
public String grantAccess(DataObject data, EndPoint ep);
27+
public boolean revokeAccess(DataObject data, EndPoint ep);
28+
public Set<DataObject> listObjects(DataStore store);
29+
public void createAsync(DataObject data, AsyncCompletionCallback<CreateCmdResult> callback);
30+
public void deleteAsync(DataObject data, AsyncCompletionCallback<CommandResult> callback);
31+
public void copyAsync(DataObject srcdata, DataObject destData, AsyncCompletionCallback<CopyCommandResult> callback);
32+
public boolean canCopy(DataObject srcData, DataObject destData);
3333
}

engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
*/
1919
package org.apache.cloudstack.engine.subsystem.api.storage;
2020

21-
public interface VolumeInfo extends DataStream {
21+
public interface VolumeInfo extends DataObject {
2222
public boolean isAttachedVM();
2323
}

engine/storage/image/src/org/apache/cloudstack/storage/image/driver/DefaultImageDataStoreDriverImpl.java

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,57 +23,64 @@
2323
import org.apache.cloudstack.engine.subsystem.api.storage.CommandResult;
2424
import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult;
2525
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;
2728
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
2829
import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
2930
import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
3031
import org.apache.cloudstack.storage.image.ImageDataStoreDriver;
3132

33+
//http-read-only based image store
3234
public class DefaultImageDataStoreDriverImpl implements ImageDataStoreDriver {
3335

3436
public DefaultImageDataStoreDriverImpl() {
3537
}
3638

3739
@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();
4142
}
4243

4344
@Override
44-
public boolean revokeAccess(DataStream data, EndPoint ep) {
45+
public boolean revokeAccess(DataObject data, EndPoint ep) {
4546
// TODO Auto-generated method stub
46-
return false;
47+
return true;
4748
}
4849

4950
@Override
50-
public Set<DataStream> listObjects(DataStore store) {
51+
public Set<DataObject> listObjects(DataStore store) {
5152
// TODO Auto-generated method stub
5253
return null;
5354
}
5455

5556
@Override
56-
public void createAsync(DataStream data,
57+
public void createAsync(DataObject data,
5758
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+
}
5965

66+
callback.complete(result);
6067
}
6168

6269
@Override
63-
public void deleteAsync(DataStream data,
70+
public void deleteAsync(DataObject data,
6471
AsyncCompletionCallback<CommandResult> callback) {
65-
// TODO Auto-generated method stub
66-
72+
CommandResult result = new CommandResult();
73+
callback.complete(result);
6774
}
6875

6976
@Override
70-
public boolean canCopy(DataStream srcData, DataStream destData) {
77+
public boolean canCopy(DataObject srcData, DataObject destData) {
7178
// TODO Auto-generated method stub
7279
return false;
7380
}
7481

7582
@Override
76-
public void copyAsync(DataStream srcdata, DataStream destData,
83+
public void copyAsync(DataObject srcdata, DataObject destData,
7784
AsyncCompletionCallback<CopyCommandResult> callback) {
7885
// TODO Auto-generated method stub
7986

engine/storage/image/src/org/apache/cloudstack/storage/image/store/ImageDataStoreImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
import javax.inject.Inject;
2424

25-
import org.apache.cloudstack.engine.subsystem.api.storage.DataStream;
25+
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
2626
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver;
2727
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole;
2828
import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
@@ -125,7 +125,7 @@ public SnapshotInfo getSnapshot(long snapshotId) {
125125

126126

127127
@Override
128-
public boolean exists(DataStream object) {
128+
public boolean exists(DataObject object) {
129129
// TODO Auto-generated method stub
130130
return false;
131131
}

engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/DefaultImageMotionStrategy.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import javax.inject.Inject;
2222

2323
import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult;
24-
import org.apache.cloudstack.engine.subsystem.api.storage.DataStream;
24+
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
2525
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
2626
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole;
2727
import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
@@ -85,7 +85,7 @@ public Object copyTemplateCallBack(AsyncCallbackDispatcher<DefaultImageMotionStr
8585
}*/
8686

8787
@Override
88-
public boolean canHandle(DataStream srcData, DataStream destData) {
88+
public boolean canHandle(DataObject srcData, DataObject destData) {
8989
DataStore destStore = destData.getDataStore();
9090
DataStore srcStore = srcData.getDataStore();
9191
if (destStore.getRole() == DataStoreRole.Image || destStore.getRole() == DataStoreRole.ImageCache
@@ -97,7 +97,7 @@ public boolean canHandle(DataStream srcData, DataStream destData) {
9797
}
9898

9999
@Override
100-
public Void copyAsync(DataStream srcData, DataStream destData,
100+
public Void copyAsync(DataObject srcData, DataObject destData,
101101
AsyncCompletionCallback<CopyCommandResult> callback) {
102102
DataStore destStore = destData.getDataStore();
103103
DataStore srcStore = srcData.getDataStore();

engine/storage/src/org/apache/cloudstack/storage/datastore/ObjectInDataStoreManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// under the License.
1717
package org.apache.cloudstack.storage.datastore;
1818

19-
import org.apache.cloudstack.engine.subsystem.api.storage.DataStream;
19+
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
2020
import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectType;
2121
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
2222
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole;
@@ -35,5 +35,5 @@ public interface ObjectInDataStoreManager {
3535
public SnapshotInfo create(SnapshotInfo snapshot, DataStore dataStore);
3636
public ObjectInDataStoreVO findObject(long objectId, DataObjectType type,
3737
long dataStoreId, DataStoreRole role);
38-
public boolean update(DataStream vo, Event event) throws NoTransitionException;
38+
public boolean update(DataObject vo, Event event) throws NoTransitionException;
3939
}

engine/storage/src/org/apache/cloudstack/storage/datastore/ObjectInDataStoreManagerImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import javax.inject.Inject;
2020

21-
import org.apache.cloudstack.engine.subsystem.api.storage.DataStream;
21+
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
2222
import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectType;
2323
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
2424
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole;
@@ -132,7 +132,7 @@ public ObjectInDataStoreVO findObject(long objectId, DataObjectType type,
132132
}
133133

134134
@Override
135-
public boolean update(DataStream data, Event event)
135+
public boolean update(DataObject data, Event event)
136136
throws NoTransitionException {
137137
ObjectInDataStoreVO obj = this.findObject(data.getId(), data.getType(),
138138
data.getDataStore().getId(), data.getDataStore().getRole());

engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStore.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import java.util.List;
2222

2323
import org.apache.cloudstack.engine.subsystem.api.storage.CommandResult;
24-
import org.apache.cloudstack.engine.subsystem.api.storage.DataStream;
24+
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
2525
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
2626
import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
2727
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
@@ -45,7 +45,7 @@ public interface PrimaryDataStore extends DataStore, PrimaryDataStoreInfo {
4545
void createVoluemFromBaseImageAsync(VolumeInfo volume, TemplateInfo templateStore, AsyncCompletionCallback<CommandResult> callback);
4646
*/
4747

48-
boolean exists(DataStream data);
48+
boolean exists(DataObject data);
4949

5050
TemplateInfo getTemplate(long templateId);
5151

engine/storage/src/org/apache/cloudstack/storage/endpoint/DefaultEndPointSelector.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
import javax.inject.Inject;
2626

27-
import org.apache.cloudstack.engine.subsystem.api.storage.DataStream;
27+
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
2828
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
2929
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole;
3030
import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
@@ -133,7 +133,7 @@ protected EndPoint findEndPointForImageMove(DataStore srcStore,
133133
}
134134

135135
@Override
136-
public EndPoint select(DataStream srcData, DataStream destData) {
136+
public EndPoint select(DataObject srcData, DataObject destData) {
137137
DataStore srcStore = srcData.getDataStore();
138138
DataStore destStore = destData.getDataStore();
139139
if (srcData.getFormat() == DiskFormat.VMDK

0 commit comments

Comments
 (0)