View Javadoc

1   /*
2    * SymmetricDS is an open source database synchronization solution.
3    *   
4    * Copyright (C) Chris Henson <chenson42@users.sourceforge.net>
5    *               
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.transport.handler;
23  
24  import java.io.OutputStream;
25  
26  import org.jumpmind.symmetric.service.IDataExtractorService;
27  import org.jumpmind.symmetric.transport.IOutgoingTransport;
28  
29  public class BatchResourceHandler extends AbstractTransportResourceHandler {
30  
31      private IDataExtractorService dataExtractorService;
32  
33      public boolean write(String batchId, OutputStream os) throws Exception {
34          IOutgoingTransport transport = createOutgoingTransport(os);
35          boolean foundBatch = dataExtractorService.extractBatchRange(transport, batchId, batchId);
36          transport.close();
37          return foundBatch;
38      }
39  
40      public void setDataExtractorService(IDataExtractorService dataExtractorService) {
41          this.dataExtractorService = dataExtractorService;
42      }
43  
44  }