net.sf.jameleon.data
Class CollectionDataDriver

java.lang.Object
  extended by net.sf.jameleon.data.CollectionDataDriver
All Implemented Interfaces:
DataDriver

public class CollectionDataDriver
extends Object
implements DataDriver

This DataDriver is used to iterator over a Collection of Objects.

Author:
Andrey Chernyshov, Christian Hargraves

Field Summary
protected  Collection items
           
protected  Iterator iterator
           
protected  String key
           
 
Constructor Summary
CollectionDataDriver()
          Creates a CollectionDataDriver You must call setKey() and setItems() in order for this DataDriver to work correctly
CollectionDataDriver(String key, Collection items)
          Creates a CollectionDataDriver
 
Method Summary
 void close()
          Closes the handle to the data source
 Map getNextRow()
          Gets the next row from the data source
 boolean hasMoreRows()
          Tells whether the data source has another row
 void open()
          Opens the handle to the data source
 void setItems(Collection items)
           
 void setKey(String key)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

items

protected Collection items

key

protected String key

iterator

protected Iterator iterator
Constructor Detail

CollectionDataDriver

public CollectionDataDriver()
Creates a CollectionDataDriver You must call setKey() and setItems() in order for this DataDriver to work correctly


CollectionDataDriver

public CollectionDataDriver(String key,
                            Collection items)
Creates a CollectionDataDriver

Parameters:
key - - the key to store the object in the collection as
items - - the collection of items to iterator over
Method Detail

setItems

public void setItems(Collection items)

setKey

public void setKey(String key)

open

public void open()
          throws IOException
Opens the handle to the data source

Specified by:
open in interface DataDriver
Throws:
IOException - when the data source can not be found.

close

public void close()
Closes the handle to the data source

Specified by:
close in interface DataDriver

getNextRow

public Map getNextRow()
Gets the next row from the data source

Specified by:
getNextRow in interface DataDriver
Returns:
a key-value HashMap representing the data row or null if no data row is available

hasMoreRows

public boolean hasMoreRows()
Tells whether the data source has another row

Specified by:
hasMoreRows in interface DataDriver
Returns:
true if the data source still has more rows


Copyright © 2003-2008 Christian Hargraves. All Rights Reserved.