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  
21  package org.jumpmind.symmetric.extract;
22  
23  import java.util.ArrayList;
24  import java.util.List;
25  
26  import org.jumpmind.symmetric.model.OutgoingBatch;
27  
28  public class DataExtractorContext implements Cloneable {
29  
30      private List<String> auditRecordsWritten = new ArrayList<String>();
31      private String lastTableName;
32      private OutgoingBatch batch;
33      private IDataExtractor dataExtractor;
34  
35      public DataExtractorContext copy(IDataExtractor extractor) {
36          this.dataExtractor = extractor;
37          DataExtractorContext newVersion;
38          try {
39              newVersion = (DataExtractorContext) super.clone();
40              newVersion.auditRecordsWritten = new ArrayList<String>();
41              return newVersion;
42          } catch (CloneNotSupportedException e) {
43              throw new RuntimeException(e);
44          }
45      }
46  
47      public List<String> getAuditRecordsWritten() {
48          return auditRecordsWritten;
49      }
50  
51      public void setLastTableName(String tableName) {
52          lastTableName = tableName;
53      }
54  
55      public boolean isLastTable(String tableName) {
56          return lastTableName.equals(tableName);
57      }
58  
59      public OutgoingBatch getBatch() {
60          return batch;
61      }
62  
63      public void setBatch(OutgoingBatch batch) {
64          this.batch = batch;
65      }
66  
67      public IDataExtractor getDataExtractor() {
68          return dataExtractor;
69      }
70  
71  }