View Javadoc

1   /*
2    * SymmetricDS is an open source database synchronization solution.
3    *   
4    * Copyright (C) Chris Henson <chenson42@users.sourceforge.net>
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 3 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, see
18   * <http://www.gnu.org/licenses/>.
19   */
20  package org.jumpmind.symmetric.load;
21  
22  import org.apache.ddlutils.model.Table;
23  import org.jumpmind.symmetric.ext.IExtensionPoint;
24  import org.jumpmind.symmetric.load.StatementBuilder.DmlType;
25  
26  /***
27   * This is an extension point that can be implemented to filter out columns from
28   * use by the dataloader. One column filter may be added per target table.
29   * </p>
30   * Please implement {@link ITableColumnFilter} instead of this class directly if
31   * you want the extension to be auto discovered.
32   */
33  public interface IColumnFilter extends IExtensionPoint {
34  
35      /***
36       * This method is always called first. Typically, you must cache the column
37       * index you are interested in order to be able to filter the column value
38       * as well.
39       * 
40       * @return The columnName that the data loader will use to build its dml.
41       */
42      public String[] filterColumnsNames(IDataLoaderContext ctx, DmlType dml, Table table, String[] columnNames);
43  
44      /***
45       * This method is always called after
46       * {@link IColumnFilter#filterColumnsNames(DmlType, String[])}. It should
47       * perform the same filtering under the same conditions for the values as
48       * was done for the column names.
49       * 
50       * @return the column values
51       */
52      public Object[] filterColumnsValues(IDataLoaderContext ctx, DmlType dml, Table table, Object[] columnValues);
53  }