SMILA (incubation) API documentation

org.eclipse.smila.blackboard.impl
Class TransientBlackboardImpl

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

public class TransientBlackboardImpl
extends java.lang.Object
implements Blackboard

The Class BlackboardServiceImpl.


Constructor Summary
TransientBlackboardImpl(RecordFilterHelper filterHelper, java.io.File attachmentsTempDir)
          create instance.
 
Method Summary
 void addAnnotation(Id id, Path path, java.lang.String name, Annotation annotation)
          Adds the annotation.
 void addLiteral(Id id, Path path, Literal literal)
          Adds the value.
protected  void checkCachedFileAttachment(Id id, java.lang.String name)
          Checks if there is cached File attachment for given Id and prevents overwriting it.
 void commit()
          commit ALL records on this blackboard to storages (if any) and release resources.
 void commit(Id id)
          All changes are written to the storages before the record is removed.
protected  boolean containsRecord(Id id)
          check if record exists on blackboard.
 void create(Id id)
          Create a new record with a given ID.
 Annotation createAnnotation(Id id)
          Creates the annotation.
 Literal createLiteral(Id id)
          Creates the literal.
 Record filterRecord(Record record, java.lang.String filterName)
          Filter record.
protected  Annotatable getAnnotableObject(Id id, Path path, boolean create)
          Returns annotable object at the specified path, optionally create missing objects on the path.
protected  Annotatable getAnnotatableObject(Id id, Path path)
          Returns annotable object at the specified path.
 Annotation getAnnotation(Id id, Path path, java.lang.String name)
          Gets the first annotation if it exists.
 java.util.Iterator<java.lang.String> getAnnotationNames(Id id, Path path)
          Gets the annotation names.
 java.util.List<Annotation> getAnnotations(Id id, Path path, java.lang.String name)
          Gets the annotations.
 byte[] getAttachment(Id id, java.lang.String name)
          Gets the attachment.
 java.io.File getAttachmentAsFile(Id id, java.lang.String name)
          Gets attachment as file.
 java.io.InputStream getAttachmentAsStream(Id id, java.lang.String name)
          Gets the attachment as stream.
protected  java.lang.String getAttachmentId(Id id, java.lang.String name)
          Calculates the attachment id that will be used as a key in binsary storage.
protected  Attribute getAttributeByName(Record record, MObject metadata, java.lang.String name, boolean create)
          get and optionally create named attribute of given mobject.
protected  Attribute getAttributeByPath(Id id, Path path)
          Returns the latest attribute specified by the given path; the last index is ignored.
protected  Attribute getAttributeByPath(Id id, Path path, boolean create)
          Returns the latest attribute specified by the given path; the last index is ignored.
 java.util.Iterator<java.lang.String> getAttributeNames(Id id)
          Returns iterator over attributes names by given record id.
 java.util.Iterator<java.lang.String> getAttributeNames(Id id, Path path)
          Returns iterator over attributes names or empty iterator if attribute was not found at the given path.
protected  Record getCachedRecord(Id id)
          Returns cached record by id or null if record is not loaded into blackboard.
 java.io.Serializable getGlobalNote(java.lang.String name)
          Gets the global note.
protected  java.util.Collection<Id> getIds()
          create a collection of all IDs of records on the blackboard.
protected  int getLastIndex(Path path)
          Returns the last index in the path.
protected  PathStep getLastStep(Path path)
          Returns the last PathStep in the path.
 Literal getLiteral(Id id, Path path)
          Get single attribute value, index is specified in last step of path, defaults to 0.
 java.util.List<Literal> getLiterals(Id id, Path path)
          Get all literal attribute values of an attribute (index of last step is irrelevant) Returns empty list if attribute was not found.
 int getLiteralsSize(Id id, Path path)
          Returns number of attribute literals at the given path.
 java.lang.String getObjectSemanticType(Id id, Path path)
          Gets the metadata object semantic type.
 int getObjectSize(Id id, Path path)
          Gets size of metadata objects contained in this attribute.
 Record getRecord(Id id)
          Gets the record.
 Record getRecord(Id id, java.lang.String filterName)
          Gets the record.
 java.io.Serializable getRecordNote(Id id, java.lang.String name)
          Gets the record note.
 boolean hasAnnotation(Id id, Path path, java.lang.String name)
          Checks for annotation.
 boolean hasAnnotations(Id id, Path path)
          Checks for annotations.
 boolean hasAttachment(Id id, java.lang.String name)
          Checks for attachment.
 boolean hasAttribute(Id id, Path path)
          Checks for attribute. index of last step is irrelevant.
 boolean hasGlobalNote(java.lang.String name)
          Checks for global note.
 boolean hasLiterals(Id id, Path path)
          Checks if attribute at the given path has literals.
 boolean hasObjects(Id id, Path path)
          Checks if attribute has sub metadata objects.
 boolean hasRecordNote(Id id, java.lang.String name)
          Checks for record note.
 void invalidate()
          remove ALL records from blackboard and release all associated resources.
 void invalidate(Id id)
          The record is removed from the blackboard.
protected  boolean isEmpty(Path path)
          Checks if given path is empty.
 void load(Id id)
          Loads record data for the given ID from persistence (or prepare it to be loaded).
 void removeAnnotation(Id id, Path path, java.lang.String name)
          Removes the annotation.
 void removeAnnotations(Id id, Path path)
          Removes the annotations.
 void removeAttachment(Id id, java.lang.String name)
          Removes the attachment.
 void removeLiteral(Id id, Path path)
          Removes the value.
 void removeLiterals(Id id, Path path)
          Removes the values.
 void removeObject(Id id, Path path)
          Removes sub-objects specified by index in last step.
 void removeObjects(Id id, Path path)
          Removes all sub-objects of specified attribute.
 void setAnnotation(Id id, Path path, java.lang.String name, Annotation annotation)
          Sets the annotation.
 void setAnnotations(Id id, Path path, java.lang.String name, java.util.List<Annotation> annotations)
          Sets the annotations.
 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 setGlobalNote(java.lang.String name, java.io.Serializable object)
          Sets the global note.
 void setLiteral(Id id, Path path, Literal literal)
          Sets the value.
 void setLiterals(Id id, Path path, java.util.List<Literal> literals)
          Sets the values.
 void setObjectSemanticType(Id id, Path path, java.lang.String typeName)
          Sets the object semantic type.
 void setRecord(Record record)
          Adds a record to the blackboard.
 void setRecordNote(Id id, java.lang.String name, java.io.Serializable object)
          Sets the record note.
 Id split(Id id, java.lang.String fragmentName)
          Creates a fragment of a given record, i.e. the record content is copied to a new ID derived from the given by adding a frament name.
 void synchronize(Record record)
          Synchronize.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransientBlackboardImpl

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

Parameters:
filterHelper - record filter manager.
attachmentsTempDir - directory to use for temporary attachment files.
Method Detail

commit

public void commit()
            throws BlackboardAccessException
commit ALL records on this blackboard to storages (if any) and release resources. It is guaranteed that the blackboard is empty after the operation, but it 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.

Specified by:
commit in interface Blackboard
Throws:
BlackboardAccessException - at least one record could not be committed.

invalidate

public void invalidate()
remove ALL records from blackboard and release all associated resources. Nothing is written to connected storage services.

Specified by:
invalidate in interface Blackboard

create

public void create(Id id)
Create a new record with a given ID. No data is loaded from persistence, if a record with this ID exists already in the storages it will be overwritten when the created record is committed. E.g. used by Connectivity to initialize the record from incoming data. If the record with the given Id is already present on the blackboard, no action happens.

Specified by:
create in interface Blackboard
Parameters:
id - the id

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
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
Parameters:
record - the record
Throws:
BlackboardAccessException

split

public Id split(Id id,
                java.lang.String fragmentName)
         throws BlackboardAccessException
Creates a fragment of a given record, i.e. the record content is copied to a new ID derived from the given by adding a frament name.

Specified by:
split in interface Blackboard
Parameters:
id - the id
fragmentName - the fragment name
Returns:
the id
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
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
Parameters:
id - the id

createLiteral

public Literal createLiteral(Id id)
                      throws BlackboardAccessException
Creates the literal.

Specified by:
createLiteral in interface Blackboard
Parameters:
id - the id
Returns:
the literal
Throws:
BlackboardAccessException - the blackboard access exception

createAnnotation

public Annotation createAnnotation(Id id)
                            throws BlackboardAccessException
Creates the annotation.

Specified by:
createAnnotation in interface Blackboard
Parameters:
id - the id
Returns:
the annotation
Throws:
BlackboardAccessException - the blackboard access exception

getAttributeNames

public java.util.Iterator<java.lang.String> getAttributeNames(Id id,
                                                              Path path)
                                                       throws BlackboardAccessException
Returns iterator over attributes names or empty iterator if attribute was not found at the given path.

Specified by:
getAttributeNames in interface Blackboard
Parameters:
id - the id
path - the path
Returns:
the attribute names
Throws:
BlackboardAccessException - the blackboard access exception

getAttributeNames

public java.util.Iterator<java.lang.String> getAttributeNames(Id id)
                                                       throws BlackboardAccessException
Returns iterator over attributes names by given record id.

Specified by:
getAttributeNames in interface Blackboard
Parameters:
id - the id
Returns:
the attribute names
Throws:
BlackboardAccessException - the blackboard access exception

hasAttribute

public boolean hasAttribute(Id id,
                            Path path)
                     throws BlackboardAccessException
Checks for attribute. index of last step is irrelevant.

Specified by:
hasAttribute in interface Blackboard
Parameters:
id - the id
path - the path
Returns:
true, if successful
Throws:
BlackboardAccessException - the blackboard access exception

hasLiterals

public boolean hasLiterals(Id id,
                           Path path)
                    throws BlackboardAccessException
Checks if attribute at the given path has literals.

Specified by:
hasLiterals in interface Blackboard
Parameters:
id - the id
path - the path
Returns:
true, if successful
Throws:
BlackboardAccessException - the blackboard access exception

getLiteralsSize

public int getLiteralsSize(Id id,
                           Path path)
                    throws BlackboardAccessException
Returns number of attribute literals at the given path. Returns 0 if attribute was not found.

Specified by:
getLiteralsSize in interface Blackboard
Parameters:
id - the id
path - the path
Returns:
the value size
Throws:
BlackboardAccessException - the blackboard access exception

getLiterals

public java.util.List<Literal> getLiterals(Id id,
                                           Path path)
                                    throws BlackboardAccessException
Get all literal attribute values of an attribute (index of last step is irrelevant) Returns empty list if attribute was not found.

Specified by:
getLiterals in interface Blackboard
Parameters:
id - the id
path - the path
Returns:
the values
Throws:
BlackboardAccessException - the blackboard access exception

getLiteral

public Literal getLiteral(Id id,
                          Path path)
                   throws BlackboardAccessException
Get single attribute value, index is specified in last step of path, defaults to 0. Returns null if attribute or literal was not found.

Specified by:
getLiteral in interface Blackboard
Parameters:
id - the id
path - the path
Returns:
the value
Throws:
BlackboardAccessException - the blackboard access exception

setLiterals

public void setLiterals(Id id,
                        Path path,
                        java.util.List<Literal> literals)
                 throws BlackboardAccessException
Sets the values.

Specified by:
setLiterals in interface Blackboard
Parameters:
id - the id
path - the path
literals - the values
Throws:
BlackboardAccessException - the blackboard access exception

setLiteral

public void setLiteral(Id id,
                       Path path,
                       Literal literal)
                throws BlackboardAccessException
Sets the value.

Specified by:
setLiteral in interface Blackboard
Parameters:
id - the id
path - the path
literal - the value
Throws:
BlackboardAccessException - the blackboard access exception

addLiteral

public void addLiteral(Id id,
                       Path path,
                       Literal literal)
                throws BlackboardAccessException
Adds the value.

Specified by:
addLiteral in interface Blackboard
Parameters:
id - the id
path - the path
literal - the value
Throws:
BlackboardAccessException - the blackboard access exception

removeLiteral

public void removeLiteral(Id id,
                          Path path)
                   throws BlackboardAccessException
Removes the value.

Specified by:
removeLiteral in interface Blackboard
Parameters:
id - the id
path - the path
Throws:
BlackboardAccessException - the blackboard access exception

removeLiterals

public void removeLiterals(Id id,
                           Path path)
                    throws BlackboardAccessException
Removes the values.

Specified by:
removeLiterals in interface Blackboard
Parameters:
id - the id
path - the path
Throws:
BlackboardAccessException - the blackboard access exception

hasObjects

public boolean hasObjects(Id id,
                          Path path)
                   throws BlackboardAccessException
Checks if attribute has sub metadata objects. Returns false if attribute was not found at the given path.

Specified by:
hasObjects in interface Blackboard
Parameters:
id - the id
path - the path
Returns:
true, if successful
Throws:
BlackboardAccessException - the blackboard access exception

getObjectSize

public int getObjectSize(Id id,
                         Path path)
                  throws BlackboardAccessException
Gets size of metadata objects contained in this attribute. Returns 0 if attribute was not found at the given path.

Specified by:
getObjectSize in interface Blackboard
Parameters:
id - the id
path - the path
Returns:
the object size
Throws:
BlackboardAccessException - the blackboard access exception

removeObject

public void removeObject(Id id,
                         Path path)
                  throws BlackboardAccessException
Removes sub-objects specified by index in last step.

Specified by:
removeObject in interface Blackboard
Parameters:
id - the id
path - the path
Throws:
BlackboardAccessException - the blackboard access exception

removeObjects

public void removeObjects(Id id,
                          Path path)
                   throws BlackboardAccessException
Removes all sub-objects of specified attribute.

Specified by:
removeObjects in interface Blackboard
Parameters:
id - the id
path - the path
Throws:
BlackboardAccessException - the blackboard access exception

getObjectSemanticType

public java.lang.String getObjectSemanticType(Id id,
                                              Path path)
                                       throws BlackboardAccessException
Gets the metadata object semantic type. Return null if attribute was not found at the given path.

Specified by:
getObjectSemanticType in interface Blackboard
Parameters:
id - the id
path - the path
Returns:
the object semantic type
Throws:
BlackboardAccessException - the blackboard access exception

setObjectSemanticType

public void setObjectSemanticType(Id id,
                                  Path path,
                                  java.lang.String typeName)
                           throws BlackboardAccessException
Sets the object semantic type.

Specified by:
setObjectSemanticType in interface Blackboard
Parameters:
id - the id
path - the path
typeName - the typename
Throws:
BlackboardAccessException - the blackboard access exception

getAnnotationNames

public java.util.Iterator<java.lang.String> getAnnotationNames(Id id,
                                                               Path path)
                                                        throws BlackboardAccessException
Gets the annotation names. Returns empty iterator if annotatable object was not found at the given path. Annotations of literals are accessed via the Literal object. Use null, "" or an empty attribute path to access root annotations of record. Use PathStep.ATTRIBUTE_ANNOTATION as index in final step to access the annotation of the attribute itself.

Specified by:
getAnnotationNames in interface Blackboard
Parameters:
id - the id
path - the path
Returns:
the annotation names
Throws:
BlackboardAccessException - the blackboard access exception

hasAnnotation

public boolean hasAnnotation(Id id,
                             Path path,
                             java.lang.String name)
                      throws BlackboardAccessException
Checks for annotation. Returns false if annotatable object was not found at the given path.

Specified by:
hasAnnotation in interface Blackboard
Parameters:
id - the id
path - the path
name - the name
Returns:
true, if successful
Throws:
BlackboardAccessException - the blackboard access exception

hasAnnotations

public boolean hasAnnotations(Id id,
                              Path path)
                       throws BlackboardAccessException
Checks for annotations. Returns false if annotatable object was not found at the given path.

Specified by:
hasAnnotations in interface Blackboard
Parameters:
id - the id
path - the path
Returns:
true, if successful
Throws:
BlackboardAccessException - the blackboard access exception

getAnnotations

public java.util.List<Annotation> getAnnotations(Id id,
                                                 Path path,
                                                 java.lang.String name)
                                          throws BlackboardAccessException
Gets the annotations. Returns empty list if annotatable object was not found at the given path.

Specified by:
getAnnotations in interface Blackboard
Parameters:
id - the id
path - the path
name - the name
Returns:
the annotations
Throws:
BlackboardAccessException - the blackboard access exception

getAnnotation

public Annotation getAnnotation(Id id,
                                Path path,
                                java.lang.String name)
                         throws BlackboardAccessException
Gets the first annotation if it exists. Returns null if annotatable object was not found at the given path.

Specified by:
getAnnotation in interface Blackboard
Parameters:
id - the id
path - the path
name - the name
Returns:
the annotation
Throws:
BlackboardAccessException - the blackboard access exception

setAnnotations

public void setAnnotations(Id id,
                           Path path,
                           java.lang.String name,
                           java.util.List<Annotation> annotations)
                    throws BlackboardAccessException
Sets the annotations.

Specified by:
setAnnotations in interface Blackboard
Parameters:
id - the id
path - the path
name - the name
annotations - the annotations
Throws:
BlackboardAccessException - the blackboard access exception

setAnnotation

public void setAnnotation(Id id,
                          Path path,
                          java.lang.String name,
                          Annotation annotation)
                   throws BlackboardAccessException
Sets the annotation.

Specified by:
setAnnotation in interface Blackboard
Parameters:
id - the id
path - the path
name - the name
annotation - the annotation
Throws:
BlackboardAccessException - the blackboard access exception

addAnnotation

public void addAnnotation(Id id,
                          Path path,
                          java.lang.String name,
                          Annotation annotation)
                   throws BlackboardAccessException
Adds the annotation.

Specified by:
addAnnotation in interface Blackboard
Parameters:
id - the id
path - the path
name - the name
annotation - the annotation
Throws:
BlackboardAccessException - the blackboard access exception

removeAnnotation

public void removeAnnotation(Id id,
                             Path path,
                             java.lang.String name)
                      throws BlackboardAccessException
Removes the annotation.

Specified by:
removeAnnotation in interface Blackboard
Parameters:
id - the id
path - the path
name - the name
Throws:
BlackboardAccessException - the blackboard access exception

removeAnnotations

public void removeAnnotations(Id id,
                              Path path)
                       throws BlackboardAccessException
Removes the annotations.

Specified by:
removeAnnotations in interface Blackboard
Parameters:
id - the id
path - the path
Throws:
BlackboardAccessException - the blackboard access exception

hasAttachment

public boolean hasAttachment(Id id,
                             java.lang.String name)
                      throws BlackboardAccessException
Checks for attachment.

Specified by:
hasAttachment in interface Blackboard
Parameters:
id - the id
name - the name
Returns:
true, if successful
Throws:
BlackboardAccessException - the blackboard access exception

getAttachment

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

Specified by:
getAttachment in interface Blackboard
Parameters:
id - the id
name - the name
Returns:
the attachment
Throws:
BlackboardAccessException

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
Parameters:
id - the id
name - the name
Returns:
the attachment as stream
Throws:
BlackboardAccessException

getAttachmentAsFile

public java.io.File getAttachmentAsFile(Id id,
                                        java.lang.String name)
                                 throws BlackboardAccessException
Gets attachment as file. Creates file containing copy of the attachment into blackboard bundle's working directory.

Specified by:
getAttachmentAsFile in interface Blackboard
Parameters:
id - the id
name - the name
Returns:
File
Throws:
BlackboardAccessException

setAttachment

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

Specified by:
setAttachment in interface Blackboard
Parameters:
id - the id
name - the name
attachment - the attachment
Throws:
BlackboardAccessException

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
Parameters:
id - the id
name - the name
attachmentStream - the attachment stream
Throws:
BlackboardAccessException

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
Parameters:
id - the id
name - the name
attachmentFile - attachment file
Throws:
BlackboardAccessException

removeAttachment

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

Specified by:
removeAttachment in interface Blackboard
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)

hasGlobalNote

public boolean hasGlobalNote(java.lang.String name)
                      throws BlackboardAccessException
Checks for global note.

Specified by:
hasGlobalNote in interface Blackboard
Parameters:
name - the name
Returns:
true, if successful
Throws:
BlackboardAccessException - the blackboard access exception

getGlobalNote

public java.io.Serializable getGlobalNote(java.lang.String name)
                                   throws BlackboardAccessException
Gets the global note.

Specified by:
getGlobalNote in interface Blackboard
Parameters:
name - the name
Returns:
the global note
Throws:
BlackboardAccessException - the blackboard access exception

setGlobalNote

public void setGlobalNote(java.lang.String name,
                          java.io.Serializable object)
                   throws BlackboardAccessException
Sets the global note.

Specified by:
setGlobalNote in interface Blackboard
Parameters:
name - the name
object - the object
Throws:
BlackboardAccessException - the blackboard access exception

hasRecordNote

public boolean hasRecordNote(Id id,
                             java.lang.String name)
                      throws BlackboardAccessException
Checks for record note.

Specified by:
hasRecordNote in interface Blackboard
Parameters:
id - the id
name - the name
Returns:
true, if successful
Throws:
BlackboardAccessException - the blackboard access exception

getRecordNote

public java.io.Serializable getRecordNote(Id id,
                                          java.lang.String name)
                                   throws BlackboardAccessException
Gets the record note.

Specified by:
getRecordNote in interface Blackboard
Parameters:
id - the id
name - the name
Returns:
the record note
Throws:
BlackboardAccessException

setRecordNote

public void setRecordNote(Id id,
                          java.lang.String name,
                          java.io.Serializable object)
                   throws BlackboardAccessException
Sets the record note.

Specified by:
setRecordNote in interface Blackboard
Parameters:
id - the id
name - the name
object - the object
Throws:
BlackboardAccessException - the blackboard access exception

synchronize

public void synchronize(Record record)
                 throws BlackboardAccessException
Synchronize.

Specified by:
synchronize in interface Blackboard
Parameters:
record - the record
Throws:
BlackboardAccessException - the blackboard access exception
See Also:
Blackboard.synchronize(org.eclipse.smila.datamodel.record.Record)

getRecord

public Record getRecord(Id id)
                 throws BlackboardAccessException
Gets the record.

Specified by:
getRecord in interface Blackboard
Parameters:
id - the id
Returns:
the record
Throws:
BlackboardAccessException - the blackboard access exception
See Also:
Blackboard.getRecord(org.eclipse.smila.datamodel.id.Id)

getRecord

public Record getRecord(Id id,
                        java.lang.String filterName)
                 throws RecordFilterNotFoundException,
                        BlackboardAccessException
Gets the record.

Specified by:
getRecord in interface Blackboard
Parameters:
id - the id
filterName - the filter name
Returns:
the record
Throws:
RecordFilterNotFoundException - the record filter not found exception
BlackboardAccessException - the blackboard access exception
See Also:
Blackboard.getRecord(org.eclipse.smila.datamodel.id.Id, java.lang.String)

filterRecord

public Record filterRecord(Record record,
                           java.lang.String filterName)
                    throws RecordFilterNotFoundException
Filter record.

Specified by:
filterRecord in interface Blackboard
Parameters:
record - the record
filterName - the filter name
Returns:
the record
Throws:
RecordFilterNotFoundException - the record filter not found exception
See Also:
Blackboard.filterRecord(org.eclipse.smila.datamodel.record.Record, java.lang.String)

getAttachmentId

protected java.lang.String getAttachmentId(Id id,
                                           java.lang.String name)
Calculates the attachment id that will be used as a key in binsary storage.

Parameters:
id - the id
name - the name
Returns:
the attachment id

checkCachedFileAttachment

protected void checkCachedFileAttachment(Id id,
                                         java.lang.String name)
                                  throws BlackboardAccessException
Checks if there is cached File attachment for given Id and prevents overwriting it.

Parameters:
id - Id
name - attachment name
Throws:
BlackboardAccessException - file exists.

getAttributeByPath

protected Attribute getAttributeByPath(Id id,
                                       Path path)
                                throws BlackboardAccessException
Returns the latest attribute specified by the given path; the last index is ignored.

Parameters:
id - the id
path - the path
Returns:
the attribute by path
Throws:
BlackboardAccessException - the blackboard access exception

getAttributeByPath

protected Attribute getAttributeByPath(Id id,
                                       Path path,
                                       boolean create)
                                throws BlackboardAccessException
Returns the latest attribute specified by the given path; the last index is ignored. Optionally create the attributes and MObjects on the path if not present.

Parameters:
id - the id
path - the path
create - true: create missing objects on path, false: return null, if path cannot be followed.
Returns:
the attribute by path
Throws:
BlackboardAccessException - the blackboard access exception

getAttributeByName

protected Attribute getAttributeByName(Record record,
                                       MObject metadata,
                                       java.lang.String name,
                                       boolean create)
get and optionally create named attribute of given mobject.

Parameters:
record - containing record providing access to factory.
metadata - metadata object to access
name - name of attribute
create - true to create a missing attribute, false to return null for missing attributes
Returns:
named attribute if it exists or has been created, else null.

getLastIndex

protected int getLastIndex(Path path)
Returns the last index in the path.

Parameters:
path - the path
Returns:
the last index

getLastStep

protected PathStep getLastStep(Path path)
Returns the last PathStep in the path.

Parameters:
path - the path
Returns:
the last step

isEmpty

protected boolean isEmpty(Path path)
Checks if given path is empty.

Parameters:
path - the path
Returns:
true, if checks if is empty

getAnnotatableObject

protected Annotatable getAnnotatableObject(Id id,
                                           Path path)
                                    throws BlackboardAccessException
Returns annotable object at the specified path.

Parameters:
id - the id
path - the path
Returns:
the annotable object
Throws:
BlackboardAccessException - the blackboard access exception

getAnnotableObject

protected Annotatable getAnnotableObject(Id id,
                                         Path path,
                                         boolean create)
                                  throws BlackboardAccessException
Returns annotable object at the specified path, optionally create missing objects on the path.

Parameters:
id - the id
path - the path
create - true to create missing objects on path
Returns:
the annotable object
Throws:
BlackboardAccessException - the blackboard access exception

getCachedRecord

protected Record getCachedRecord(Id id)
Returns cached record by id or null if record is not loaded into blackboard.

Parameters:
id - Record id
Returns:
Record

containsRecord

protected boolean containsRecord(Id id)
check if record exists on blackboard.

Parameters:
id - record ID
Returns:
true if a record with this ID is currently loaded.

getIds

protected java.util.Collection<Id> getIds()
create a collection of all IDs of records on the blackboard.

Returns:
collection containing IDs of all currently loaded records.

SMILA (incubation) API documentation