View Javadoc

1   /*
2    * SymmetricDS is an open source database synchronization solution.
3    *   
4    * Copyright (C) Eric Long <erilong@users.sourceforge.net>,
5    *               Chris Henson <chenson42@users.sourceforge.net>
6    *
7    * This library is free software; you can redistribute it and/or
8    * modify it under the terms of the GNU Lesser General Public
9    * License as published by the Free Software Foundation; either
10   * version 3 of the License, or (at your option) any later version.
11   *
12   * This library is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this library; if not, see
19   * <http://www.gnu.org/licenses/>.
20   */
21  
22  package org.jumpmind.symmetric.service;
23  
24  import java.io.BufferedReader;
25  import java.io.IOException;
26  import java.io.InputStream;
27  import java.io.OutputStream;
28  import java.util.List;
29  
30  import org.jumpmind.symmetric.load.IBatchListener;
31  import org.jumpmind.symmetric.load.IColumnFilter;
32  import org.jumpmind.symmetric.load.IDataLoader;
33  import org.jumpmind.symmetric.load.IDataLoaderFilter;
34  import org.jumpmind.symmetric.load.IDataLoaderStatistics;
35  import org.jumpmind.symmetric.load.csv.CsvLoader;
36  import org.jumpmind.symmetric.model.Node;
37  import org.jumpmind.symmetric.transport.IIncomingTransport;
38  import org.jumpmind.symmetric.transport.ITransportManager;
39  import org.springframework.transaction.annotation.Transactional;
40  
41  public interface IDataLoaderService {
42  
43      @Transactional
44      public boolean loadData(Node remote, Node local) throws IOException;
45  
46      @Transactional
47      public boolean loadData(IIncomingTransport reader);
48  
49      @Transactional
50      public void loadData(InputStream in, OutputStream out) throws IOException;
51  
52      /***
53       * This is a convenience method for a client that might need to load CSV
54       * formatted data using SymmetricDS's {@link IDataLoader}.
55       * 
56       * @param batchData
57       *                Data string formatted for the configured loader (the only
58       *                supported data loader today is the {@link CsvLoader})
59       * @throws IOException
60       */
61      @Transactional
62      public IDataLoaderStatistics loadDataBatch(String batchData) throws IOException;
63  
64      public void addDataLoaderFilter(IDataLoaderFilter filter);
65  
66      public void setDataLoaderFilters(List<IDataLoaderFilter> filters);
67  
68      public void removeDataLoaderFilter(IDataLoaderFilter filter);
69  
70      public void setTransportManager(ITransportManager transportManager);
71  
72      public void addColumnFilter(String tableName, IColumnFilter filter);
73  
74      public void addBatchListener(IBatchListener listener);
75  
76      public IDataLoader openDataLoader(BufferedReader reader) throws IOException;
77  }