SMILA (incubation) API documentation

org.eclipse.smila.blackboard.impl
Class PersistingBlackboardImpl

java.lang.Object
  extended by org.eclipse.smila.blackboard.impl.TransientBlackboardImpl
      extended by org.eclipse.smila.blackboard.impl.PersistingBlackboardImpl
All Implemented Interfaces:
Blackboard

public class PersistingBlackboardImpl
extends TransientBlackboardImpl

The Class BlackboardServiceImpl.


Constructor Summary
PersistingBlackboardImpl(RecordFilterHelper filterHelper, java.io.File attachmentsTempDir)
          create instance.
 
Method Summary
 void commit(Id id)
          All changes are written to the storages before the record is removed.
 byte[] getAttachment(Id id, java.lang.String name)
          Gets the attachment.
 java.io.InputStream getAttachmentAsStream(Id id, java.lang.String name)
          Gets the attachment as stream.
 void invalidate(Id id)
          The record is removed from the blackboard.
 void load(Id id)
          Loads record data for the given ID from persistence (or prepare it to be loaded).
 void removeAttachment(Id id, java.lang.String name)
          Removes the attachment.
 void setAttachment(Id id, java.lang.String name, byte[] attachment)
          Sets the attachment.
 void setAttachmentFromFile(Id id, java.lang.String name, java.io.File attachmentFile)
          Sets attachment from file.
 void setAttachmentFromStream(Id id, java.lang.String name, java.io.InputStream attachmentStream)
          Sets the attachment from stream.
 void setBinaryStorage(BinaryStorageService binaryStorage)
          Set the binary service for blackboard.
 void setRecord(Record record)
          Adds a record to the blackboard.
 void setRecordStorage(RecordStorage recordStorage)
          Set the record service for blackboard.
 
Methods inherited from class org.eclipse.smila.blackboard.impl.TransientBlackboardImpl
addAnnotation, addLiteral, checkCachedFileAttachment, commit, containsRecord, create, createAnnotation, createLiteral, filterRecord, getAnnotableObject, getAnnotatableObject, getAnnotation, getAnnotationNames, getAnnotations, getAttachmentAsFile, getAttachmentId, getAttributeByName, getAttributeByPath, getAttributeByPath, getAttributeNames, getAttributeNames, getCachedRecord, getGlobalNote, getIds, getLastIndex, getLastStep, getLiteral, getLiterals, getLiteralsSize, getObjectSemanticType, getObjectSize, getRecord, getRecord, getRecordNote, hasAnnotation, hasAnnotations, hasAttachment, hasAttribute, hasGlobalNote, hasLiterals, hasObjects, hasRecordNote, invalidate, isEmpty, removeAnnotation, removeAnnotations, removeLiteral, removeLiterals, removeObject, removeObjects, setAnnotation, setAnnotations, setGlobalNote, setLiteral, setLiterals, setObjectSemanticType, setRecordNote, split, synchronize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistingBlackboardImpl

public PersistingBlackboardImpl(RecordFilterHelper filterHelper,
                                java.io.File attachmentsTempDir)
create instance.

Parameters:
filterHelper - record filters
attachmentsTempDir - directory for temp files for file based access to attachment.
Method Detail

setRecordStorage

public void setRecordStorage(RecordStorage recordStorage)
Set the record service for blackboard. To be used by Declarative Services as the bind method.

Parameters:
recordStorage - RecordStorage - the record storage service interface

setBinaryStorage

public void setBinaryStorage(BinaryStorageService binaryStorage)
Set the binary service for blackboard. To be used by Declarative Services as the bind method.

Parameters:
binaryStorage - BinaryStorageService - the binary storage service interface

load

public void load(Id id)
          throws BlackboardAccessException
Loads record data for the given ID from persistence (or prepare it to be loaded). Used by a client to indicate that it wants to process this record.

Specified by:
load in interface Blackboard
Overrides:
load in class TransientBlackboardImpl
Parameters:
id - the id
Throws:
BlackboardAccessException - the blackboard access exception

setRecord

public void setRecord(Record record)
               throws BlackboardAccessException
Adds a record to the blackboard.

Specified by:
setRecord in interface Blackboard
Overrides:
setRecord in class TransientBlackboardImpl
Parameters:
record - the record
Throws:
BlackboardAccessException - the blackboard access exception

commit

public void commit(Id id)
            throws BlackboardAccessException
All changes are written to the storages before the record is removed. The record is unlocked in the database.

Specified by:
commit in interface Blackboard
Overrides:
commit in class TransientBlackboardImpl
Parameters:
id - the id
Throws:
BlackboardAccessException - the blackboard access exception

invalidate

public void invalidate(Id id)
The record is removed from the blackboard. The record is unlocked in the database. If the record was created new (not overwritten) on this blackboard it should be removed from the storage completely.

Specified by:
invalidate in interface Blackboard
Overrides:
invalidate in class TransientBlackboardImpl
Parameters:
id - the id

getAttachment

public byte[] getAttachment(Id id,
                            java.lang.String name)
                     throws BlackboardAccessException
Gets the attachment.

Specified by:
getAttachment in interface Blackboard
Overrides:
getAttachment in class TransientBlackboardImpl
Parameters:
id - the id
name - the name
Returns:
the attachment
Throws:
BlackboardAccessException - the blackboard access exception

getAttachmentAsStream

public java.io.InputStream getAttachmentAsStream(Id id,
                                                 java.lang.String name)
                                          throws BlackboardAccessException
Gets the attachment as stream.

Specified by:
getAttachmentAsStream in interface Blackboard
Overrides:
getAttachmentAsStream in class TransientBlackboardImpl
Parameters:
id - the id
name - the name
Returns:
the attachment as stream
Throws:
BlackboardAccessException - the blackboard access exception

setAttachment

public void setAttachment(Id id,
                          java.lang.String name,
                          byte[] attachment)
                   throws BlackboardAccessException
Sets the attachment.

Specified by:
setAttachment in interface Blackboard
Overrides:
setAttachment in class TransientBlackboardImpl
Parameters:
id - the id
name - the name
attachment - the attachment
Throws:
BlackboardAccessException - the blackboard access exception

setAttachmentFromStream

public void setAttachmentFromStream(Id id,
                                    java.lang.String name,
                                    java.io.InputStream attachmentStream)
                             throws BlackboardAccessException
Sets the attachment from stream.

Specified by:
setAttachmentFromStream in interface Blackboard
Overrides:
setAttachmentFromStream in class TransientBlackboardImpl
Parameters:
id - the id
name - the name
attachmentStream - the attachment stream
Throws:
BlackboardAccessException - the blackboard access exception

setAttachmentFromFile

public void setAttachmentFromFile(Id id,
                                  java.lang.String name,
                                  java.io.File attachmentFile)
                           throws BlackboardAccessException
Sets attachment from file.

Specified by:
setAttachmentFromFile in interface Blackboard
Overrides:
setAttachmentFromFile in class TransientBlackboardImpl
Parameters:
id - the id
name - the name
attachmentFile - attachment file
Throws:
BlackboardAccessException - BlackboardAccessException

removeAttachment

public void removeAttachment(Id id,
                             java.lang.String name)
                      throws BlackboardAccessException
Removes the attachment.

Specified by:
removeAttachment in interface Blackboard
Overrides:
removeAttachment in class TransientBlackboardImpl
Parameters:
id - the id
name - the name
Throws:
BlackboardAccessException - the blackboard access exception
See Also:
Blackboard.removeAttachment(org.eclipse.smila.datamodel.id.Id, java.lang.String)

SMILA (incubation) API documentation