Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 367152 - Record/Blackboard: Introduce an interface for Attachment
Summary: Record/Blackboard: Introduce an interface for Attachment
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Smila (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Juergen Schumacher CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-20 03:11 EST by Juergen Schumacher CLA
Modified: 2022-07-07 11:31 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Juergen Schumacher CLA 2011-12-20 03:11:27 EST
I'm going to change the interface of Record and Blackboard concerning the attachment methods. The plan is to introduce an interface "org.eclipse.smila.datamodel.Attachment" for attachments instead of using plain byte[]. The purpose of this is to be able later to support attachments larger than 2 GB or to be able to introduce streaming of attachments without using the blackboard (e.g. in job workers). Though we will not implement any new features now, we want to introduce the new interface now so that we have a chance of implementing this after SMILA 1.0 without breaking the interface (hopefully :-). If you have created own pipelets or other stuff using attachments, you may have to change get/setAttachment calls to new names afterwards, but apart from this there should be no bigger problems.
Comment 1 Juergen Schumacher CLA 2011-12-21 03:04:06 EST
I've committed a first version. Please review and feel free to discuss (though I will not be able to do changes before Jan 5th 2012 ;-)

To adapt your code, it should be sufficient to replace invocations of record.getAttachment() and blackboard.getAttachment() by calls to record.getAttachmentsAsBytes(...) or blackboard.getAttachmentAsBytes(...) respectively.

Additionally, you cannot call setAttachment(name, (byte[]) null)) anymore, it will throw an AttachmentException (a RuntimeException). Use setAttachment(new StoredAttachment(name(, size)?)) to denote that an attachment is stored in a persistence service instead of in-memory. Also, blackboard.getRecord(id).getAttachmentAsBytes() will throw an AttachmentException now if the attachment content is in BinaryStorage (instead of returning as before). Use blackboard.getAttachmentAsBytes(id, name). We can implement a subclass of StoredAttachment later, that will be able to retrieve the content from BinaryStorage on-demand (so that attachments in BinStorage or other persistence services can be supported without having to use the blackboard).
Comment 2 Juergen Schumacher CLA 2012-01-13 07:48:32 EST
No objections so far, so I'll close this thing for now.