de.unihalle.informatik.Alida.operator
Class ALDPortHashAccess

java.lang.Object
  extended by de.unihalle.informatik.Alida.operator.ALDPortHashAccess

public class ALDPortHashAccess
extends java.lang.Object

Interface to the port hash map of Alida.

This class implements the interface to access the port hash. It yields the only possibility to access the hash, direct access is blocked to guarantee consistency.

Author:
moeller, posch

Field Summary
protected static java.lang.String ALD_EXTENSION
          File extension of Alida processing history files.
 
Constructor Summary
protected ALDPortHashAccess()
          Constructor without function.
 
Method Summary
protected  ALDPort getHistoryLink(java.lang.Object obj)
          Get the port to which the object is currently linked in history.
 int getNumEntries()
          Returns the number of objects currently stored in the history database.
protected  boolean isRegistered(java.lang.Object obj)
          Check if an object is registered in the hash.
protected  void readHistory(java.lang.Object obj, java.lang.String filename)
          Read and set the processing history from file.
protected  void register(java.lang.Object obj)
          Register the object in the hash.
protected  void setHistoryLink(java.lang.Object obj, ALDPort port)
          Set the port to which the object is currently linked in history.
protected  void writeHistory(java.lang.Object obj, java.lang.String filename)
          Deprecated.  
protected  void writeHistory(java.lang.Object obj, java.lang.String filename, ALDProcessingDAG.HistoryType historyType)
          Deprecated.  
protected  void writeHistory(java.lang.Object obj, java.lang.String filename, ALDProcessingDAG.HistoryType historyType, boolean ignoreHiding)
          Write the processing history (if available) to a graphml file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALD_EXTENSION

protected static final java.lang.String ALD_EXTENSION
File extension of Alida processing history files.

Constructor Detail

ALDPortHashAccess

protected ALDPortHashAccess()
Constructor without function.

Note that there will only be only one processing history per session and not many different objects of this type.

Method Detail

getNumEntries

public int getNumEntries()
Returns the number of objects currently stored in the history database.

Note that the number can be larger than the number of objects actually referenced from the Java process due to the management of weak references of the Java Garbage Collector.


readHistory

protected void readHistory(java.lang.Object obj,
                           java.lang.String filename)
Read and set the processing history from file.

If no graphML processing history could be find, the method checks if an arbitrary XML tree is available. If this fails, too, the data object is left without any processing history. As a result of a call of this method either a graphmlHistory or an xmlHistory object (if available) is added to the port of the object.

The extension ald is used for the history filename and replaces the extension in filename or is appended to filename if filename does not contain an extension. If no history file with extension ald can be found, the method looks for a file with extension mph which denotes history files of an early implementation of Alida.

If the object is of type ALDData the location property is set from filename and lateron documented in the processing history.

Parameters:
filename - Filename of processing history (XML file).

writeHistory

@Deprecated
protected void writeHistory(java.lang.Object obj,
                                       java.lang.String filename)
                     throws ALDProcessingDAGException,
                            ALDOperatorException
Deprecated. 

Write the processing history (if any) to a graphml file.

Equivalent to writeHistory(obj, filename, ALDProcessingDAG.HistoryType.COMPLETE, false).

Throws:
ALDProcessingDAGException
ALDOperatorException

writeHistory

@Deprecated
protected void writeHistory(java.lang.Object obj,
                                       java.lang.String filename,
                                       ALDProcessingDAG.HistoryType historyType)
                     throws ALDProcessingDAGException,
                            ALDOperatorException
Deprecated. 

Write the processing history (if any) to a graphml file.

Equivalent to writeHistory(obj, filename, historyType, false).

Throws:
ALDProcessingDAGException
ALDOperatorException

writeHistory

protected void writeHistory(java.lang.Object obj,
                            java.lang.String filename,
                            ALDProcessingDAG.HistoryType historyType,
                            boolean ignoreHiding)
                     throws ALDProcessingDAGException,
                            ALDOperatorException
Write the processing history (if available) to a graphml file.

The processing history is created using the opNodes and their ports starting with this data object. If no history is available (e.g. if this object is created internally and not output of an operator) then no history file is written. The extension ald is used and replaces the extension in filename or is appended to filename if filename does not contain a extension. If filename already has extension ald an exception in thrown.

Parameters:
obj - Object for which the history to write for.
filename - Filename to write the processing history into. (as graphml/XML file)
historyType - Type/mode of the history.
ignoreHiding - If true, hiding of opNodes is ignored.
Throws:
ALDProcessingDAGException
ALDOperatorException

isRegistered

protected boolean isRegistered(java.lang.Object obj)
Check if an object is registered in the hash.

Parameters:
obj - Object to check.
Returns:
True, if object is known to the hash.

register

protected void register(java.lang.Object obj)
Register the object in the hash.

Parameters:
obj - Object to register.

getHistoryLink

protected ALDPort getHistoryLink(java.lang.Object obj)
Get the port to which the object is currently linked in history.

Returns:
Current port to which data is linked.

setHistoryLink

protected void setHistoryLink(java.lang.Object obj,
                              ALDPort port)
Set the port to which the object is currently linked in history.

Parameters:
port - New port data is currently linked to.


Copyright © 2010-2014 Martin Luther University Halle-Wittenberg. All Rights Reserved.