|
SMILA (incubation) API documentation | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Blackboard
The Blackboard is a container for a set of records that are processed in a single step, e.g. to add a crawled record to SMILA in connectivity or to process a single queue message. The blackboard can be connected to storage services (binary storage, record storage) so that existing versions of records can be loaded before the processing starts and the result records can be persisted afterwards. However, a blackboard can also be just "transient", i.e. not connected to any storage services. Then no data will be persisted automatically by the blackboard, the client must care about handling of the results in this case.
Nested Class Summary | |
---|---|
static class |
Blackboard.Get
use as an argument in {@link #getRecord(String, CreateMode). |
Method Summary | |
---|---|
void |
commit()
commit ALL records on this blackboard to storages (if any) and release resources. |
void |
commitRecord(java.lang.String id)
All changes are written to the storages before the record is removed. |
Record |
filterRecord(Record record,
java.lang.String filterName)
Filter record metadata. |
byte[] |
getAttachment(java.lang.String id,
java.lang.String name)
Gets the attachment. |
java.io.InputStream |
getAttachmentAsStream(java.lang.String id,
java.lang.String name)
Gets the attachment as stream. |
DataFactory |
getDataFactory()
|
java.io.Serializable |
getGlobalNote(java.lang.String name)
Gets the global note. |
AnyMap |
getMetadata(java.lang.String id)
Shortcut for getRecord(String) + Record.getMetadata() . |
Record |
getRecord(java.lang.String id)
Get current version of record with given ID. |
Record |
getRecord(java.lang.String id,
Blackboard.Get mode)
get a reference to the record on the blackboard. |
Record |
getRecord(java.lang.String id,
java.lang.String filterName)
Shortcut for getRecord(String) + #filterRecord(Record, String)) : Gets the blackboard record and
applies the named filter. |
java.io.Serializable |
getRecordNote(java.lang.String id,
java.lang.String name)
Gets the record note. |
boolean |
hasAttachment(java.lang.String id,
java.lang.String name)
Checks for attachment. |
boolean |
hasGlobalNote(java.lang.String name)
Checks for global note. |
boolean |
hasRecordNote(java.lang.String id,
java.lang.String name)
Checks for record note. |
void |
removeAttachment(java.lang.String id,
java.lang.String name)
Removes the attachment. |
void |
removeRecord(java.lang.String id)
remove record completely from blackboard. |
void |
setAttachment(java.lang.String id,
java.lang.String name,
byte[] attachment)
Sets the attachment. |
void |
setAttachmentFromFile(java.lang.String id,
java.lang.String name,
java.io.File attachmentFile)
Sets attachment from file. |
void |
setAttachmentFromStream(java.lang.String id,
java.lang.String name,
java.io.InputStream attachmentStream)
Sets the attachment from stream. |
void |
setGlobalNote(java.lang.String name,
java.io.Serializable object)
Sets the global note. |
void |
setRecord(Record record)
Sets a record on the blackboard. |
void |
setRecordNote(java.lang.String id,
java.lang.String name,
java.io.Serializable object)
Sets the record note. |
void |
synchronizeRecord(Record record)
Synchronize: copy all attributes and attachments from the incoming record to the blackboard record with the same ID. |
void |
unload()
remove ALL records from blackboard and release all associated resources. |
void |
unloadRecord(java.lang.String id)
The record is removed from the blackboard. |
Method Detail |
---|
DataFactory getDataFactory()
Record getRecord(java.lang.String id, Blackboard.Get mode) throws BlackboardAccessException
Blackboard.Get
for details on the
mode parameter.
id
- the idmode
- configure behavior of method.
BlackboardAccessException
Record getRecord(java.lang.String id) throws BlackboardAccessException
getRecord(String, Get)
with Blackboard.Get.EXISTING
.
This method is usually the correct one to use in pipelets or workers to process a record.
id
- the id
BlackboardAccessException
- error accessing attached storagesAnyMap getMetadata(java.lang.String id) throws BlackboardAccessException
getRecord(String)
+ Record.getMetadata()
. If getRecord(String)
would yield
null, this method yields null, too.
id
- the id
BlackboardAccessException
- error accessing attached storagesRecord getRecord(java.lang.String id, java.lang.String filterName) throws BlackboardAccessException, RecordFilterNotFoundException
getRecord(String)
+ #filterRecord(Record, String))
: Gets the blackboard record and
applies the named filter.
id
- the idfilterName
- the filter name
BlackboardAccessException
- error accessing storages for reading the record
RecordFilterNotFoundException
- named record filter does not existRecord filterRecord(Record record, java.lang.String filterName) throws RecordFilterNotFoundException
record
- the recordfilterName
- the filter name
RecordFilterNotFoundException
- named record filter does not existvoid setRecord(Record record) throws BlackboardAccessException
record
- the record
BlackboardAccessException
- error accessing storages for reading the record or writing attachmentsvoid synchronizeRecord(Record record) throws BlackboardAccessException
record
- the record
BlackboardAccessException
- error accessing storages for reading the record or writing attachmentsvoid removeRecord(java.lang.String id)
commit()
or commitRecord(String)
is called.
id
- record idboolean hasAttachment(java.lang.String id, java.lang.String name) throws BlackboardAccessException
id
- the idname
- the name
BlackboardAccessException
- error accessing storages for checkbyte[] getAttachment(java.lang.String id, java.lang.String name) throws BlackboardAccessException
id
- the idname
- the name
BlackboardAccessException
- error accessing storages for reading the record or attachmentjava.io.InputStream getAttachmentAsStream(java.lang.String id, java.lang.String name) throws BlackboardAccessException
id
- the idname
- the name
BlackboardAccessException
- error accessing storages for reading the record or attachmentvoid setAttachment(java.lang.String id, java.lang.String name, byte[] attachment) throws BlackboardAccessException
id
- the idname
- the nameattachment
- the attachment
BlackboardAccessException
- error if record does not exist or on errors accessing storages for reading the record or writing the
attachmentvoid setAttachmentFromStream(java.lang.String id, java.lang.String name, java.io.InputStream attachmentStream) throws BlackboardAccessException
id
- the idname
- the nameattachmentStream
- the attachment stream
BlackboardAccessException
- error if record does not exist or on errors accessing storages for reading the record or writing the
attachmentvoid setAttachmentFromFile(java.lang.String id, java.lang.String name, java.io.File attachmentFile) throws BlackboardAccessException
id
- the idname
- the nameattachmentFile
- attachment file
BlackboardAccessException
- error if record does not exist or on errors accessing storages for reading the record or writing the
attachmentvoid removeAttachment(java.lang.String id, java.lang.String name) throws BlackboardAccessException
id
- the idname
- the name
BlackboardAccessException
- error if record does not exist or on errors accessing storages for reading the record or deleting the
attachmentboolean hasGlobalNote(java.lang.String name)
name
- the name
java.io.Serializable getGlobalNote(java.lang.String name)
name
- the name
void setGlobalNote(java.lang.String name, java.io.Serializable object)
name
- the nameobject
- the objectboolean hasRecordNote(java.lang.String id, java.lang.String name)
id
- the idname
- the name
java.io.Serializable getRecordNote(java.lang.String id, java.lang.String name)
id
- the idname
- the name
void setRecordNote(java.lang.String id, java.lang.String name, java.io.Serializable object)
id
- the idname
- the nameobject
- the objectvoid commitRecord(java.lang.String id) throws BlackboardAccessException
id
- the id
BlackboardAccessException
- the blackboard access exceptionvoid unloadRecord(java.lang.String id)
id
- the idvoid commit() throws BlackboardAccessException
commit ALL records on this blackboard to storages (if any) and release resources.
The records will not be unloaded from the blackboard.
The operation throws an exception if at least one record could not be committed (e.g. written to storages) successfully. However, the implementation should try to commit as many records as possible and not stop on the first failed commit and invalidate the remaining records.
BlackboardAccessException
- at least one record could not be committed.void unload()
|
SMILA (incubation) API documentation | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |