01: /*
02: * Copyright 2006-2007, Unitils.org
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.unitils.dbunit.datasetloadstrategy;
17:
18: import org.dbunit.dataset.IDataSet;
19: import org.unitils.dbunit.util.DbUnitDatabaseConnection;
20:
21: /**
22: * Defines the contract for implementations that specify an operation that needs to be executed on the database, given
23: * a DbUnit dataset. Implementations typically call an implementation of DbUnit's <code>DatabaseOperation</code> class.
24: * Implementations must have an empty constructor so that an instance can be created using reflection.
25: * <p/>
26: * The concrete implementation class that is used can be configured using the annotation attribute
27: * {@link org.unitils.dbunit.annotation.DataSet#loadStrategy()}. A default can be specified using the property
28: * <code>DbUnitModule.DataSet.loadStrategy.default</code>.
29: * <p/>
30: * This wrapper mechanism makes it very easy to use custom DbUnit <code>DatabaseOperation</code> composite object
31: * structures, without sacrificing the powerfulness of Unitils' configuration system.
32: *
33: * @author Filip Neven
34: * @author Tim Ducheyne
35: */
36: public interface DataSetLoadStrategy {
37:
38: /**
39: * Executes this DataSetLoadStrategy. This means the given dataset is inserted in the database using the given dbUnit
40: * database connection object.
41: *
42: * @param dbUnitDatabaseConnection DbUnit class providing access to the database
43: * @param dataSet The dbunit dataset
44: */
45: void execute(DbUnitDatabaseConnection dbUnitDatabaseConnection,
46: IDataSet dataSet);
47: }
|