appl.parallel.data
Class AbstractDataHandler

java.lang.Object
  extended by appl.parallel.data.AbstractDataHandler
All Implemented Interfaces:
DataLoader, DataUnloader, DataLoadHandler, PartitionDataHandler, Serializable, Cloneable
Direct Known Subclasses:
XuluClientLoader, XuluGridSharedFileSystemLoader

public abstract class AbstractDataHandler
extends Object
implements PartitionDataHandler

This class is used as a base class for loaders. It is especially intended for use with the SPMD-Paradigm, but may be used with other loaders, too. It implements the reusable stuff of the PartitionDataHandler Interface. Notice that each loader is responsible for exactly one data element. It must be Cloneable, so that multi-data elements can add another element.

Author:
Dominik Appl
See Also:
Serialized Form

Field Summary
protected  DataPartition data
          the currently handled data (must be initialized before calling unload()
protected  Logger LOG
           
protected  Rectangle partitionBounds
          The partition bounds (the whole bounds) of the current SplittableResource
protected  int rootID
          The id of the currently handled SplittableResource
protected  ClientDataServer spmdClient
          A ClientDataServer may be used locally for faster access.
protected  Rectangle unloadBounds
          The unload bounds differ may differ from the partitionBounds.
 
Constructor Summary
AbstractDataHandler()
          (empty constructors are important for deserialization)
AbstractDataHandler(int rootID, ClientDataServer client, Rectangle partitionBounds, Rectangle unloadBounds)
          Constructs a new AbstractDataHandler.
 
Method Summary
 PartitionDataHandler clone()
           
abstract  String getLoadInfo()
           
abstract  String getUnloadInfo()
           
abstract  DataPartition load()
          On invocation the data is loaded and returned
 void setBasePartition(DataPartition data)
           
 void setRootID(int rootID)
           
 void setSPMDClient(ClientDataServer localSPMDClient)
          sets a local ClientDataServer which MAY be used by the handler for local access
 void setUnloadBounds(Rectangle unloadBounds)
          sets the bounds of the data to be unloaded so that not all data is unloaded to the destination.
abstract  void unload()
          unloads the Data to a specific location
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface appl.parallel.data.PartitionDataHandler
newInstance
 

Field Detail

LOG

protected transient Logger LOG

rootID

protected int rootID
The id of the currently handled SplittableResource


partitionBounds

protected Rectangle partitionBounds
The partition bounds (the whole bounds) of the current SplittableResource


data

protected transient DataPartition data
the currently handled data (must be initialized before calling unload()


unloadBounds

protected Rectangle unloadBounds
The unload bounds differ may differ from the partitionBounds. If there is a neighborhood region it is important, that only the core-region (without the neighborhood) is unloaded.


spmdClient

protected transient ClientDataServer spmdClient
A ClientDataServer may be used locally for faster access.

Constructor Detail

AbstractDataHandler

public AbstractDataHandler(int rootID,
                           ClientDataServer client,
                           Rectangle partitionBounds,
                           Rectangle unloadBounds)
Constructs a new AbstractDataHandler. The local IP address at the time of construction is later used on serverside for communication (e.g. unloading).

Parameters:
rootID - the id of the data
client - a ClientDataServer which may be used to get meta information on client side before transferring the loader to its destination
partitionBounds - the bounds of the partition to be retrieved on server side
unloadBounds - the bounds of the partition which is to be uploaded to the client after calculation (may only be the calculation area)

AbstractDataHandler

public AbstractDataHandler()
(empty constructors are important for deserialization)

See Also:
AbstractDataHandler(int, ClientDataServer, Rectangle, Rectangle)
Method Detail

setSPMDClient

public void setSPMDClient(ClientDataServer localSPMDClient)
sets a local ClientDataServer which MAY be used by the handler for local access

Specified by:
setSPMDClient in interface PartitionDataHandler
Parameters:
localSPMDClient -

getLoadInfo

public abstract String getLoadInfo()
Specified by:
getLoadInfo in interface DataLoader
Returns:
some general information about the loading class (like what the class exactly loads)

getUnloadInfo

public abstract String getUnloadInfo()
Specified by:
getUnloadInfo in interface DataUnloader
Returns:
a short description of what the class exactly does

load

public abstract DataPartition load()
                            throws LoadingException
Description copied from interface: DataLoader
On invocation the data is loaded and returned

Specified by:
load in interface DataLoader
Specified by:
load in interface PartitionDataHandler
Returns:
the newly loaded object
Throws:
LoadingException - if for some reason the data could not be loaded

setUnloadBounds

public void setUnloadBounds(Rectangle unloadBounds)
Description copied from interface: PartitionDataHandler
sets the bounds of the data to be unloaded so that not all data is unloaded to the destination. This is for example useful if there is a neighborhood region which should not be uploaded to the destination.

Specified by:
setUnloadBounds in interface PartitionDataHandler

setBasePartition

public void setBasePartition(DataPartition data)
Specified by:
setBasePartition in interface PartitionDataHandler

unload

public abstract void unload()
Description copied from interface: DataUnloader
unloads the Data to a specific location

Specified by:
unload in interface DataUnloader

setRootID

public void setRootID(int rootID)
Specified by:
setRootID in interface PartitionDataHandler

clone

public PartitionDataHandler clone()
Specified by:
clone in interface PartitionDataHandler
Overrides:
clone in class Object