1 /*
2 *
3 * The DbUnit Database Testing Framework
4 * Copyright (C)2002-2008, DbUnit.org
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 */
21 package org.dbunit.util.fileloader;
22
23 import java.util.Map;
24
25 import org.dbunit.DatabaseUnitRuntimeException;
26 import org.dbunit.dataset.IDataSet;
27
28 /**
29 * Defines a dbUnit data file loader supporting replacement objects and
30 * substrings with {@link org.dbunit.dataset.ReplacementDataSet}.
31 *
32 * @author Jeff Jensen jeffjensen AT users.sourceforge.net
33 * @author Last changed by: $Author$
34 * @version $Revision$ $Date$
35 * @since 2.4.8
36 */
37 public interface DataFileLoader {
38 /**
39 * Load the specified filename from the classpath into a dbUnit dataset. If
40 * filename == null or "", then returns an empty
41 * {@link org.dbunit.dataset.DefaultDataSet}.
42 *
43 * @param filename
44 * The dbUnit file to load, in the format for the loader
45 * implementation and fully qualified name with package syntax.
46 * @return The dbUnit dataset of the specified file.
47 * @throws DatabaseUnitRuntimeException
48 * DataSetException wrapped in a DatabaseUnitRuntimeException
49 * when file load errors occur.
50 */
51 IDataSet load(String fileName);
52
53 /**
54 * Add the specified replacement objects to existing ones for use with
55 * {@link org.dbunit.dataset.ReplacementDataSet}.
56 *
57 * @param replacementObjects
58 * The replacement objects to include.
59 * @since 2.4.8
60 */
61 void addReplacementObjects(Map replacementObjects);
62
63 /**
64 * Add the specified replacement substrings to existing ones for use with
65 * {@link org.dbunit.dataset.ReplacementDataSet}.
66 *
67 * @param replacementSubstrings
68 * The replacement substrings to include.
69 * @since 2.4.8
70 */
71 void addReplacementSubstrings(Map replacementSubstrings);
72
73 /**
74 * Remove all existing replacement objects, resetting to none so no object
75 * replacements occur.
76 *
77 * @since 2.4.8
78 */
79 void removeAllReplacementObjects();
80
81 /**
82 * Remove all existing replacement substring objects, resetting to none so
83 * no substring replacements occur.
84 *
85 * @since 2.4.8
86 */
87 void removeAllReplacementSubstrings();
88 }