Search in sources :

Example 6 with ProtocolDataWriter

use of org.jumpmind.symmetric.io.data.writer.ProtocolDataWriter in project symmetric-ds by JumpMind.

the class DataExtractorService method extractOnlyOutgoingBatch.

/**
     * This method will extract an outgoing batch, but will not update the outgoing batch status
     */
public boolean extractOnlyOutgoingBatch(String nodeId, long batchId, Writer writer) {
    boolean extracted = false;
    Node targetNode = null;
    if (Constants.UNROUTED_NODE_ID.equals(nodeId)) {
        targetNode = new Node(nodeId, parameterService.getNodeGroupId());
    } else {
        targetNode = nodeService.findNode(nodeId);
    }
    if (targetNode != null) {
        OutgoingBatch batch = outgoingBatchService.findOutgoingBatch(batchId, nodeId);
        if (batch != null) {
            IDataWriter dataWriter = new ProtocolDataWriter(nodeService.findIdentityNodeId(), writer, targetNode.requires13Compatiblity());
            List<OutgoingBatch> batches = new ArrayList<OutgoingBatch>(1);
            batches.add(batch);
            batches = extract(new ProcessInfo(), targetNode, batches, dataWriter, null, ExtractMode.EXTRACT_ONLY);
            extracted = batches.size() > 0;
        }
    }
    return extracted;
}
Also used : ProtocolDataWriter(org.jumpmind.symmetric.io.data.writer.ProtocolDataWriter) Node(org.jumpmind.symmetric.model.Node) ArrayList(java.util.ArrayList) OutgoingBatch(org.jumpmind.symmetric.model.OutgoingBatch) ProcessInfo(org.jumpmind.symmetric.model.ProcessInfo) IDataWriter(org.jumpmind.symmetric.io.data.IDataWriter)

Aggregations

ProtocolDataWriter (org.jumpmind.symmetric.io.data.writer.ProtocolDataWriter)6 OutgoingBatch (org.jumpmind.symmetric.model.OutgoingBatch)5 Node (org.jumpmind.symmetric.model.Node)4 DataContext (org.jumpmind.symmetric.io.data.DataContext)3 DataProcessor (org.jumpmind.symmetric.io.data.DataProcessor)3 ExtractDataReader (org.jumpmind.symmetric.io.data.reader.ExtractDataReader)3 ProcessInfo (org.jumpmind.symmetric.model.ProcessInfo)3 ArrayList (java.util.ArrayList)2 IDataReader (org.jumpmind.symmetric.io.data.IDataReader)2 IDataWriter (org.jumpmind.symmetric.io.data.IDataWriter)2 OutgoingBatches (org.jumpmind.symmetric.model.OutgoingBatches)2 BufferedWriter (java.io.BufferedWriter)1 IOException (java.io.IOException)1 URL (java.net.URL)1 Column (org.jumpmind.db.model.Column)1 PlatformColumn (org.jumpmind.db.model.PlatformColumn)1 Table (org.jumpmind.db.model.Table)1 IoException (org.jumpmind.exception.IoException)1 Batch (org.jumpmind.symmetric.io.data.Batch)1 CsvData (org.jumpmind.symmetric.io.data.CsvData)1