public class BlackboardImpl extends java.lang.Object implements Blackboard
Blackboard.Get| Constructor and Description |
|---|
BlackboardImpl(RecordFilterHelper filterHelper)
create instance.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
Attachment |
getAttachment(java.lang.String id,
java.lang.String name)
Gets the attachment.
|
byte[] |
getAttachmentAsBytes(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
Blackboard.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
Blackboard.getRecord(String) + #filterRecord(Record, String)): Gets the blackboard record and
applies the named filter. |
Record |
getRecordCopy(java.lang.String id,
boolean withAttachments)
get a shallow copy of the record on the blackboard.
|
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 |
removeAll()
remove all records currently stored on blackboard.
|
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,
Attachment attachment)
Sets the attachment.
|
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.
|
protected void |
setBinaryStorage(BinaryStorageService binaryStorage)
Set the binary service for blackboard.
|
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.
|
protected void |
setRecordStorage(RecordStorage recordStorage)
Set the record service for blackboard.
|
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.
|
public BlackboardImpl(RecordFilterHelper filterHelper)
filterHelper - record filter manager.public DataFactory getDataFactory()
getDataFactory in interface Blackboardpublic Record getRecord(java.lang.String id, Blackboard.Get mode) throws BlackboardAccessException
BlackboardBlackboard.Get for details on the
mode parameter.getRecord in interface Blackboardid - the idmode - configure behavior of method.BlackboardAccessExceptionpublic Record getRecord(java.lang.String id) throws BlackboardAccessException
BlackboardBlackboard.getRecord(String, Get) with Blackboard.Get.EXISTING.
This method is usually the correct one to use in pipelets or workers to process a record.getRecord in interface Blackboardid - the idBlackboardAccessException - error accessing attached storagespublic AnyMap getMetadata(java.lang.String id) throws BlackboardAccessException
BlackboardBlackboard.getRecord(String) + Record.getMetadata(). If Blackboard.getRecord(String) would yield
null, this method yields null, too.getMetadata in interface Blackboardid - the idBlackboardAccessException - error accessing attached storagespublic Record getRecord(java.lang.String id, java.lang.String filterName) throws RecordFilterNotFoundException, BlackboardAccessException
BlackboardBlackboard.getRecord(String) + #filterRecord(Record, String)): Gets the blackboard record and
applies the named filter.getRecord in interface Blackboardid - the idfilterName - the filter nameRecordFilterNotFoundException - named record filter does not existBlackboardAccessException - error accessing storages for reading the recordpublic Record filterRecord(Record record, java.lang.String filterName) throws RecordFilterNotFoundException
BlackboardfilterRecord in interface Blackboardrecord - the recordfilterName - the filter nameRecordFilterNotFoundException - named record filter does not existpublic Record getRecordCopy(java.lang.String id, boolean withAttachments) throws BlackboardAccessException
BlackboardgetRecordCopy in interface Blackboardid - the idBlackboardAccessExceptionpublic void setRecord(Record record) throws BlackboardAccessException
BlackboardsetRecord in interface Blackboardrecord - the recordBlackboardAccessException - error accessing storages for reading the record or writing attachmentspublic void synchronizeRecord(Record record) throws BlackboardAccessException
BlackboardsynchronizeRecord in interface Blackboardrecord - the recordBlackboardAccessException - error accessing storages for reading the record or writing attachmentspublic void removeRecord(java.lang.String id)
BlackboardBlackboard.commit() or Blackboard.commitRecord(String) is called.removeRecord in interface Blackboardid - record idpublic void removeAll()
BlackboardBlackboard.commit() or Blackboard.commitRecord(String) is called.removeAll in interface Blackboardpublic boolean hasAttachment(java.lang.String id,
java.lang.String name)
throws BlackboardAccessException
BlackboardhasAttachment in interface Blackboardid - the idname - the nameBlackboardAccessException - error accessing storages for checkpublic Attachment getAttachment(java.lang.String id, java.lang.String name) throws BlackboardAccessException
BlackboardgetAttachment in interface Blackboardid - the idname - the nameBlackboardAccessException - error accessing storages for reading the record or attachmentpublic byte[] getAttachmentAsBytes(java.lang.String id,
java.lang.String name)
throws BlackboardAccessException
BlackboardgetAttachmentAsBytes in interface Blackboardid - the idname - the nameBlackboardAccessException - error accessing storages for reading the record or attachmentpublic java.io.InputStream getAttachmentAsStream(java.lang.String id,
java.lang.String name)
throws BlackboardAccessException
BlackboardgetAttachmentAsStream in interface Blackboardid - the idname - the nameBlackboardAccessException - error accessing storages for reading the record or attachmentpublic void setAttachment(java.lang.String id,
Attachment attachment)
throws BlackboardAccessException
BlackboardsetAttachment in interface Blackboardid - the idattachment - the attachmentBlackboardAccessException - error if record does not exist or on errors accessing storages for reading the record or writing the
attachmentpublic void setAttachment(java.lang.String id,
java.lang.String name,
byte[] attachment)
throws BlackboardAccessException
BlackboardsetAttachment in interface Blackboardid - the idname - the nameattachment - the attachmentBlackboardAccessException - error if record does not exist or on errors accessing storages for reading the record or writing the
attachmentpublic void setAttachmentFromStream(java.lang.String id,
java.lang.String name,
java.io.InputStream attachmentStream)
throws BlackboardAccessException
BlackboardsetAttachmentFromStream in interface Blackboardid - the idname - the nameattachmentStream - the attachment streamBlackboardAccessException - error if record does not exist or on errors accessing storages for reading the record or writing the
attachmentpublic void setAttachmentFromFile(java.lang.String id,
java.lang.String name,
java.io.File attachmentFile)
throws BlackboardAccessException
BlackboardsetAttachmentFromFile in interface Blackboardid - the idname - the nameattachmentFile - attachment fileBlackboardAccessException - error if record does not exist or on errors accessing storages for reading the record or writing the
attachmentpublic void removeAttachment(java.lang.String id,
java.lang.String name)
throws BlackboardAccessException
BlackboardremoveAttachment in interface Blackboardid - the idname - the nameBlackboardAccessException - error if record does not exist or on errors accessing storages for reading the record or deleting the
attachmentpublic boolean hasGlobalNote(java.lang.String name)
BlackboardhasGlobalNote in interface Blackboardname - the namepublic java.io.Serializable getGlobalNote(java.lang.String name)
BlackboardgetGlobalNote in interface Blackboardname - the namepublic void setGlobalNote(java.lang.String name,
java.io.Serializable object)
BlackboardsetGlobalNote in interface Blackboardname - the nameobject - the objectpublic boolean hasRecordNote(java.lang.String id,
java.lang.String name)
BlackboardhasRecordNote in interface Blackboardid - the idname - the namepublic java.io.Serializable getRecordNote(java.lang.String id,
java.lang.String name)
BlackboardgetRecordNote in interface Blackboardid - the idname - the namepublic void setRecordNote(java.lang.String id,
java.lang.String name,
java.io.Serializable object)
BlackboardsetRecordNote in interface Blackboardid - the idname - the nameobject - the objectpublic void commitRecord(java.lang.String id)
throws BlackboardAccessException
BlackboardcommitRecord in interface Blackboardid - the idBlackboardAccessException - the blackboard access exceptionpublic void unloadRecord(java.lang.String id)
BlackboardunloadRecord in interface Blackboardid - the idpublic void commit()
throws BlackboardAccessException
Blackboardcommit 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.
commit in interface BlackboardBlackboardAccessException - at least one record could not be committed.public void unload()
Blackboardunload in interface Blackboardprotected void setRecordStorage(RecordStorage recordStorage)
recordStorage - RecordStorage - the record storage service interfaceprotected void setBinaryStorage(BinaryStorageService binaryStorage)
binaryStorage - BinaryStorageService - the binary storage service interface