Gephi Toolkit Javadoc

org.gephi.data.attributes.spi
Class AttributeValueDelegateProvider<T>

java.lang.Object
  extended by org.gephi.data.attributes.spi.AttributeValueDelegateProvider<T>
Type Parameters:
T - type parameter used to restrict delegate id type

public abstract class AttributeValueDelegateProvider<T>
extends java.lang.Object

General information

Provider for delegating attribute value. Using this interface it is possible to delegate the real value of AttributeValue object to database (relational, graph, ...), index/search engine, ...
For every node/edge it is possible to add, get, set and remove every attribute value.

Implementation details

As of implementation detail of AttributeValue immutability, both adding and setting the attribute value is done through the set[Edge|Node]AttributeValue() method, so it is absolutely necessary to treat both cases in the method body.
Every method takes at least 2 arguments: Delegate id is any type of object necessary to get the right node/edge. For instance for Neo4j it is of type Long, which is directly used as Neo4j node/relationship id. For other storing engines which require indexing key and value it could be crate (wrapper object) wrapping both values with proper types.
Attribute column is used usually for getting the column id which is used as property name.

Automatic and manual type conversions

Important thing about the whole delegating process is type conversion. It is clear that there might exist type mismatch between Gephi types and types which are supported in storing engine. During implementation it is necessary to fulfill following requirements:

Usage

Every AttributeColumn has direct link to its own AttributeValueDelegateProvider. This means that it is possible to have more Providers in the same AttributeTable, each delegating from a subset of all columns. And because the fact that every AttributeValue has link to its AttributeColumn, it has direct access to its Provider too.
Provider will be called for getting value for every AttributeValue which has column with AttributeOrigin.DELEGATE. The first setValue() method call on Attributes/AttributeRow will set the delegate id and every other will change data in storing engine.

Best practises

Every implementing class should be implemented as singleton because of memory savings. This singleton should be passed during populating AttributeTable / creating columns.
Any other necessary implementation information / resources (as concrete database instance) should be set using static methods.
Any necessary convertor described in Automatic and manual type conversions should be implemented as static inner class.

Author:
Martin Ć kurla

Constructor Summary
AttributeValueDelegateProvider()
           
 
Method Summary
abstract  void deleteEdgeAttributeValue(T delegateId, AttributeColumn attributeColumn)
          Deletes the delegated edge attribute value.
abstract  void deleteNodeAttributeValue(T delegateId, AttributeColumn attributeColumn)
          Deletes the delegated node attribute value.
 boolean equals(java.lang.Object obj)
           
abstract  java.lang.Object getEdgeAttributeValue(T delegateId, AttributeColumn attributeColumn)
          Returns the delegated edge attribute value.
abstract  java.lang.Object getNodeAttributeValue(T delegateId, AttributeColumn attributeColumn)
          Returns the delegated node attribute value.
abstract  GraphItemDelegateFactoryProvider<T> graphItemDelegateFactoryProvider()
           
 int hashCode()
           
abstract  void setEdgeAttributeValue(T delegateId, AttributeColumn attributeColumn, java.lang.Object edgeValue)
          Adds or sets the delegated edge attribute value.
abstract  void setNodeAttributeValue(T delegateId, AttributeColumn attributeColumn, java.lang.Object nodeValue)
          Adds or sets the delegated node attribute value.
abstract  java.lang.String storageEngineName()
          Returns name of storage engine.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributeValueDelegateProvider

public AttributeValueDelegateProvider()
Method Detail

getNodeAttributeValue

public abstract java.lang.Object getNodeAttributeValue(T delegateId,
                                                       AttributeColumn attributeColumn)
Returns the delegated node attribute value.

Parameters:
delegateId - delegate id
attributeColumn - attribute column
Returns:
delegated node attribute value

setNodeAttributeValue

public abstract void setNodeAttributeValue(T delegateId,
                                           AttributeColumn attributeColumn,
                                           java.lang.Object nodeValue)
Adds or sets the delegated node attribute value. It is necessary to treat both cases in the method body!

Parameters:
delegateId - delegate id
attributeColumn - attribute column
nodeValue - new/changed delegated node attribute value

deleteNodeAttributeValue

public abstract void deleteNodeAttributeValue(T delegateId,
                                              AttributeColumn attributeColumn)
Deletes the delegated node attribute value.

Parameters:
delegateId - delegate id
attributeColumn - attribute column

getEdgeAttributeValue

public abstract java.lang.Object getEdgeAttributeValue(T delegateId,
                                                       AttributeColumn attributeColumn)
Returns the delegated edge attribute value.

Parameters:
delegateId - delegate id
attributeColumn - attribute column
Returns:
delegated edge attribute value

setEdgeAttributeValue

public abstract void setEdgeAttributeValue(T delegateId,
                                           AttributeColumn attributeColumn,
                                           java.lang.Object edgeValue)
Adds or sets the delegated edge attribute value. It is necessary to treat both cases in the method body!

Parameters:
delegateId - delegate id
attributeColumn - attribute column
nodeValue - new/changed delegated edge attribute value

deleteEdgeAttributeValue

public abstract void deleteEdgeAttributeValue(T delegateId,
                                              AttributeColumn attributeColumn)
Deletes the delegated edge attribute value.

Parameters:
delegateId - delegate id
attributeColumn - attribute column

storageEngineName

public abstract java.lang.String storageEngineName()
Returns name of storage engine. This is used when graph uses more storage engines and where must be an option how to differ them in GUI.

Returns:
name of storage engine

graphItemDelegateFactoryProvider

public abstract GraphItemDelegateFactoryProvider<T> graphItemDelegateFactoryProvider()

equals

public final boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public final int hashCode()
Overrides:
hashCode in class java.lang.Object

Gephi Toolkit Javadoc