KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cayenne > access > DataPortDelegate


1 /*****************************************************************
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  ****************************************************************/

19
20 package org.apache.cayenne.access;
21
22 import java.util.List JavaDoc;
23
24 import org.apache.cayenne.map.DbEntity;
25 import org.apache.cayenne.query.Query;
26
27 /**
28  * Interface for callback and delegate methods allowing implementing classes to control
29  * various aspects of data porting via DataPort. DataPort instance will invoke appropriate
30  * delegate methods during different stages of porting process.
31  *
32  * @since 1.2: Prior to 1.2 DataPort classes were a part of cayenne-examples package.
33  * @author Andrus Adamchik
34  */

35 public interface DataPortDelegate {
36
37     /**
38      * Allows delegate to sort or otherwise alter a list of DbEntities right before the
39      * port starts.
40      */

41     List JavaDoc willPortEntities(DataPort portTool, List JavaDoc entities);
42
43     /**
44      * Invoked by DataPort right before the start of data port for a given entity. Allows
45      * delegate to handle such things like logging, etc. Also makes it possible to
46      * substitute or alter the select query used to fecth the source data, e.g. set a
47      * limiting qualifier.
48      */

49     Query willPortEntity(DataPort portTool, DbEntity entity, Query query);
50
51     /**
52      * Invoked by DataPort right after the end of data port for a given entity. Allows
53      * delegate to handle such things like logging, etc.
54      */

55     void didPortEntity(DataPort portTool, DbEntity entity, int rowCount);
56
57     /**
58      * Allows delegate to sort or otherwise alter a list of DbEntities right before data
59      * cleanup starts.
60      */

61     List JavaDoc willCleanData(DataPort portTool, List JavaDoc entities);
62
63     /**
64      * Invoked by DataPort right before the start of data cleanup for a given entity.
65      * Allows delegate to handle such things like logging, etc. Also makes it possible to
66      * substitute or alter the delete query used to cleanup the data, e.g. set a limiting
67      * qualifier.
68      */

69     Query willCleanData(DataPort portTool, DbEntity entity, Query query);
70
71     /**
72      * Invoked by DataPort right after the end of data cleanup for a given entity. Allows
73      * delegate to handle such things like logging, etc.
74      */

75     void didCleanData(DataPort portTool, DbEntity entity, int rowCount);
76 }
77
Popular Tags