Task #3523
Don't use the byte array to store data in the D1Object class
100%
Description
Currently, the bye array is used to store data in the D1Object. It may cause some memory issue if the data is huge.
The design in this page describes a solution by using the interface DataStore:
https://repository.dataone.org/documents/Projects/cicore/architecture/api-documentation/source/design/morpho/images/morpho-class-diagram.png
Some proposed changes in the D1Object class:
-add: getDataOutputStream() and setDataInputStream()
-modify: getData() and setData() to operate without actually storing the byte[]
-Use the DataStore to store the data rather than byte array
I also would like to add org.dataone.client.datastore.DataStore interface and org.dataone.client.datastore.MemoryDataStore class in the d1_libclient_java module. The MemoryDataStore class implements the DataStore interface.
The APIs in the DataStore are:
OutputStream get(Identifier identifier);
void set(Identifier identifier, InputStream data);
Any comment and suggestion?
Thanks!
History
#1 Updated by Jing Tao almost 12 years ago
Rob would like to use thejavax.activiation.DataSource interface rather than DataStore interface in the D1Object.
http://docs.oracle.com/javaee/5/api/javax/activation/DataSource.html
He has a code in a branch:
https://repository.dataone.org/software/cicore/branches/d1_libclient_java_rwn_packaging/src/main/java/org/dataone/client/D1Object.java
I think we should keep byte[] getData() and void setData(byte[] data) (without store the byte[] in order to make r client work.
#2 Updated by Jing Tao almost 12 years ago
- Status changed from New to Closed
- Assignee changed from Jing Tao to Rob Nahf
- translation missing: en.field_remaining_hours set to 0.0
Now we use the DataSource to store the real data. The java doc for the DataSource locates at:
http://docs.oracle.com/javase/6/docs/api/javax/activation/DataSource.html
in the D1Object we have those four methods:
public DataSource getDataSource();
public void setDataSource(DataSource dataSource);
public byte[] getData();
public void setData(byte[] data);
The getData and setData are marked as deprecated. Also they don't store the byte[] in the object.