|
SMILA (incubation) API documentation | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.smila.blackboard.impl.BlackboardImpl
public class BlackboardImpl
A non-persisting Blackboard implementation.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.eclipse.smila.blackboard.Blackboard |
---|
Blackboard.Get |
Constructor Summary | |
---|---|
BlackboardImpl(RecordFilterHelper filterHelper)
create instance. |
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 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. |
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. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BlackboardImpl(RecordFilterHelper filterHelper)
filterHelper
- record filter manager.Method Detail |
---|
public DataFactory getDataFactory()
getDataFactory
in interface Blackboard
public Record getRecord(java.lang.String id, Blackboard.Get mode) throws BlackboardAccessException
Blackboard.Get
for details on the
mode parameter.
getRecord
in interface Blackboard
id
- the idmode
- configure behavior of method.
BlackboardAccessException
public Record getRecord(java.lang.String id) throws BlackboardAccessException
Blackboard.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 Blackboard
id
- the id
BlackboardAccessException
- error accessing attached storagespublic AnyMap getMetadata(java.lang.String id) throws BlackboardAccessException
Blackboard.getRecord(String)
+ Record.getMetadata()
. If Blackboard.getRecord(String)
would yield
null, this method yields null, too.
getMetadata
in interface Blackboard
id
- the id
BlackboardAccessException
- error accessing attached storagespublic Record getRecord(java.lang.String id, java.lang.String filterName) throws RecordFilterNotFoundException, BlackboardAccessException
Blackboard.getRecord(String)
+ #filterRecord(Record, String))
: Gets the blackboard record and
applies the named filter.
getRecord
in interface Blackboard
id
- the idfilterName
- the filter name
RecordFilterNotFoundException
- named record filter does not exist
BlackboardAccessException
- error accessing storages for reading the recordpublic Record filterRecord(Record record, java.lang.String filterName) throws RecordFilterNotFoundException
filterRecord
in interface Blackboard
record
- the recordfilterName
- the filter name
RecordFilterNotFoundException
- named record filter does not existpublic void setRecord(Record record) throws BlackboardAccessException
setRecord
in interface Blackboard
record
- the record
BlackboardAccessException
- error accessing storages for reading the record or writing attachmentspublic void synchronizeRecord(Record record) throws BlackboardAccessException
synchronizeRecord
in interface Blackboard
record
- the record
BlackboardAccessException
- error accessing storages for reading the record or writing attachmentspublic void removeRecord(java.lang.String id)
Blackboard.commit()
or Blackboard.commitRecord(String)
is called.
removeRecord
in interface Blackboard
id
- record idpublic boolean hasAttachment(java.lang.String id, java.lang.String name) throws BlackboardAccessException
hasAttachment
in interface Blackboard
id
- the idname
- the name
BlackboardAccessException
- error accessing storages for checkpublic byte[] getAttachment(java.lang.String id, java.lang.String name) throws BlackboardAccessException
getAttachment
in interface Blackboard
id
- the idname
- the name
BlackboardAccessException
public java.io.InputStream getAttachmentAsStream(java.lang.String id, java.lang.String name) throws BlackboardAccessException
getAttachmentAsStream
in interface Blackboard
id
- the idname
- the name
BlackboardAccessException
public void setAttachment(java.lang.String id, java.lang.String name, byte[] attachment) throws BlackboardAccessException
setAttachment
in interface Blackboard
id
- the idname
- the nameattachment
- the attachment
BlackboardAccessException
public void setAttachmentFromStream(java.lang.String id, java.lang.String name, java.io.InputStream attachmentStream) throws BlackboardAccessException
setAttachmentFromStream
in interface Blackboard
id
- the idname
- the nameattachmentStream
- the attachment stream
BlackboardAccessException
public void setAttachmentFromFile(java.lang.String id, java.lang.String name, java.io.File attachmentFile) throws BlackboardAccessException
setAttachmentFromFile
in interface Blackboard
id
- the idname
- the nameattachmentFile
- attachment file
BlackboardAccessException
public void removeAttachment(java.lang.String id, java.lang.String name) throws BlackboardAccessException
removeAttachment
in interface Blackboard
id
- the idname
- the name
BlackboardAccessException
- error if record does not exist or on errors accessing storages for reading the record or deleting the
attachmentorg.eclipse.smila.blackboard.Blackboard#removeAttachment(org.eclipse.smila.datamodel.id.Id, java.lang.String)
public boolean hasGlobalNote(java.lang.String name)
hasGlobalNote
in interface Blackboard
name
- the name
public java.io.Serializable getGlobalNote(java.lang.String name)
getGlobalNote
in interface Blackboard
name
- the name
public void setGlobalNote(java.lang.String name, java.io.Serializable object)
setGlobalNote
in interface Blackboard
name
- the nameobject
- the objectpublic boolean hasRecordNote(java.lang.String id, java.lang.String name)
hasRecordNote
in interface Blackboard
id
- the idname
- the name
public java.io.Serializable getRecordNote(java.lang.String id, java.lang.String name)
getRecordNote
in interface Blackboard
id
- the idname
- the name
BlackboardAccessException
public void setRecordNote(java.lang.String id, java.lang.String name, java.io.Serializable object)
setRecordNote
in interface Blackboard
id
- the idname
- the nameobject
- the objectpublic void commitRecord(java.lang.String id) throws BlackboardAccessException
commitRecord
in interface Blackboard
id
- the id
BlackboardAccessException
- the blackboard access exceptionpublic void unloadRecord(java.lang.String id)
unloadRecord
in interface Blackboard
id
- the idpublic void 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.
commit
in interface Blackboard
BlackboardAccessException
- at least one record could not be committed.public void unload()
unload
in interface Blackboard
protected void setRecordStorage(RecordStorage recordStorage)
recordStorage
- RecordStorage - the record storage service interfaceprotected void setBinaryStorage(BinaryStorageService binaryStorage)
binaryStorage
- BinaryStorageService - the binary storage service interface
|
SMILA (incubation) API documentation | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |