i3.dragos.gm.core.schema
Interface MetaAttributable

All Known Subinterfaces:
Attribute, Edge, EdgeClass, Graph, GraphClass, GraphEntity, GraphEntityClass, GraphPool, Node, NodeClass, Relation, RelationClass, RelationEnd, RelationEndClass
All Known Implementing Classes:
AbstractAttribute, AttributeProxy, EdgeClassProxy, EdgeProxy, FilteringGraphPool, GraphClassProxy, GraphEntityClassProxy, GraphEntityProxy, GraphProxy, NodeClassProxy, NodeProxy, RelationClassProxy, RelationEndClassProxy, RelationEndProxy, RelationProxy

public interface MetaAttributable

Identifies classes that can store simple key-value pairs for instances.

Please note: These meta-attributes are not inherited by subclasses in the schema!

All modifying methods may fire an EntityInUseException if a reserved key is used. Thus, a graph model that uses meta attributes internally can prevent these from being overwritten. Such usage (and the reserved keys) should be documented.

Since the getAllMetaAttributes() also returns mappings for reserved meta-attributes, it is recommended that the values used for those are immutable to prevent external manipulation.

The Objects used as values must be serializable, meaning they not only implement the Serializable interface, but also make sure their members are also serializable.

Meta-Attributes allow null values.

Author:
Thorsten Hermes <thermes@i3.informatik.rwth-aachen.de>
See Also:
Core Graph Model, Implementation Issues

Method Summary
 java.util.Map<java.lang.String,java.io.Serializable> getAllMetaAttributes()
          Returns a map containing all currently set meta-attribute key-value pairs.
 java.io.Serializable getMetaAttribute(java.lang.String key)
          Returns the current value of a meta-attribute.
 boolean isMetaAttributeKeyReserved(java.lang.String key)
          Checks whether a meta-attribute key is reserved for internal use.
 boolean isMetaAttributeSet(java.lang.String key)
          Checks whether a meta-attribute is set.
 void setMetaAttribute(java.lang.String key, java.io.Serializable value)
          Sets a meta-attribute.
 void unsetMetaAttribute(java.lang.String key)
          Removes a meta-attribute.
 

Method Detail

setMetaAttribute

void setMetaAttribute(java.lang.String key,
                      java.io.Serializable value)
                      throws EntityInUseException,
                             DragosException
Sets a meta-attribute. Any old value will be overwritten.

Parameters:
key - The key that identifies the meta attribute.
value - The (new) value of this meta-attribute.
Throws:
java.lang.IllegalArgumentException - if key is null.
EntityInUseException - if a key name is reserved for internal use.
DragosException - if this object is no longer in its GraphPool/Schema, or something else went wrong.

unsetMetaAttribute

void unsetMetaAttribute(java.lang.String key)
                        throws EntityInUseException,
                               DragosException
Removes a meta-attribute. If no value was set before, this method has no effect.

Parameters:
key - The key that identifies the meta attribute.
Throws:
java.lang.IllegalArgumentException - if key is null.
EntityInUseException - if a key name is reserved for internal use.
DragosException - if this object is no longer in its GraphPool/Schema, or something else went wrong.

getMetaAttribute

java.io.Serializable getMetaAttribute(java.lang.String key)
                                      throws EntityNotFoundException,
                                             DragosException
Returns the current value of a meta-attribute.

Parameters:
key - The key that identifies the meta attribute.
Returns:
The current value of this meta-attribute.
Throws:
java.lang.IllegalArgumentException - if key is null.
EntityNotFoundException - if no meta-attribute with that name exists.
DragosException - if this object is no longer in its GraphPool/Schema, or something else went wrong.

isMetaAttributeSet

boolean isMetaAttributeSet(java.lang.String key)
                           throws DragosException
Checks whether a meta-attribute is set. Meta-attributes with reserved keys are not treated in any special way by this method.

Parameters:
key - The key that identifies the meta attribute.
Returns:
true if the meta-attribute is set, false otherwise.
Throws:
java.lang.IllegalArgumentException - if key is null.
DragosException - if this object is no longer in its GraphPool/Schema, or something else went wrong.

getAllMetaAttributes

java.util.Map<java.lang.String,java.io.Serializable> getAllMetaAttributes()
                                                                          throws DragosException
Returns a map containing all currently set meta-attribute key-value pairs.

Returns:
A Map containing key-value pairs for all set meta-attributes.
Throws:
DragosException - if this object is no longer in its GraphPool/Schema, or something else went wrong.

isMetaAttributeKeyReserved

boolean isMetaAttributeKeyReserved(java.lang.String key)
                                   throws DragosException
Checks whether a meta-attribute key is reserved for internal use.

Parameters:
key - The key in question.
Returns:
true if this meta-attribute key is reserved, false otherwise.
Throws:
java.lang.IllegalArgumentException - if key is null.
DragosException - if this object is no longer in its GraphPool/Schema, or something else went wrong.


Copyright © 2002-2008 RWTH Aachen, Department of Computer Science 3 (Software Engineering). All Rights Reserved.