View Javadoc

1   /*
2   
3       Jameleon - An automation testing tool..
4       Copyright (C) 2003 Christian W. Hargraves (engrean@hotmail.com)
5       
6       This library is free software; you can redistribute it and/or
7       modify it under the terms of the GNU Lesser General Public
8       License as published by the Free Software Foundation; either
9       version 2.1 of the License, or (at your option) any later version.
10  
11      This library is distributed in the hope that it will be useful,
12      but WITHOUT ANY WARRANTY; without even the implied warranty of
13      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14      Lesser General Public License for more details.
15  
16      You should have received a copy of the GNU Lesser General Public
17      License along with this library; if not, write to the Free Software
18      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */
20  package net.sf.jameleon.data;
21  
22  import java.io.IOException;
23  
24  import java.util.Map;
25  
26  /***
27   * This interface is used to implement different ways to get
28   * data from a source. Some examples might be a database, an xml
29   * file or even an Excel spreadsheet (besides just using a CSV file).
30   */
31  public interface DataDriver{
32  
33      /***
34       * Opens the handle to the data source
35       * @throws IOException when the data source can not be found.
36       */
37      public void open() throws IOException;
38  
39      /***
40       * Closes the handle to the data source
41       */
42      public void close();
43  
44      /***
45       * Gets the next row from the data source
46       * @return a key-value HashMap representing the data row or null if 
47       * no data row is available
48       */
49      public Map getNextRow();
50  
51      /***
52       * Tells whether the data source has another row
53       * @return true if the data source still has more rows
54       */
55      public boolean hasMoreRows();
56  
57  }