org.apache.ace.server.log.task
Class LogSyncTask

java.lang.Object
  extended by org.apache.ace.server.log.task.LogSyncTask
All Implemented Interfaces:
Runnable, org.apache.ace.log.LogSync

public class LogSyncTask
extends Object
implements Runnable, org.apache.ace.log.LogSync


Constructor Summary
LogSyncTask(String endpoint, String name)
           
 
Method Summary
protected  List<org.apache.ace.log.LogDescriptor> calculateDelta(List<org.apache.ace.log.LogDescriptor> source, List<org.apache.ace.log.LogDescriptor> destination)
          Calculates the difference between two lists of LogDescriptor.
protected  boolean doPull(URL host, List<org.apache.ace.log.LogDescriptor> localRanges, List<org.apache.ace.log.LogDescriptor> remoteRanges)
           
protected  boolean doPush(URL host, List<org.apache.ace.log.LogDescriptor> localRanges, List<org.apache.ace.log.LogDescriptor> remoteRanges)
           
 String getName()
           
protected  List<org.apache.ace.log.LogDescriptor> getRanges(InputStream stream)
           
 boolean pull()
           
 boolean push()
           
 boolean pushpull()
           
protected  void readLogs(BufferedReader reader)
           
 void run()
           
protected  void writeDelta(List<org.apache.ace.log.LogDescriptor> descriptors, Writer writer)
          Writes the difference between local and remote to a writer.
protected  void writeLogDescriptor(org.apache.ace.log.LogDescriptor descriptor, Writer writer)
          Writes the LogEvents described by the descriptor to the writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogSyncTask

public LogSyncTask(String endpoint,
                   String name)
Method Detail

run

public void run()
Specified by:
run in interface Runnable

pull

public boolean pull()
             throws IOException
Specified by:
pull in interface org.apache.ace.log.LogSync
Throws:
IOException

push

public boolean push()
             throws IOException
Specified by:
push in interface org.apache.ace.log.LogSync
Throws:
IOException

pushpull

public boolean pushpull()
                 throws IOException
Specified by:
pushpull in interface org.apache.ace.log.LogSync
Throws:
IOException

doPush

protected boolean doPush(URL host,
                         List<org.apache.ace.log.LogDescriptor> localRanges,
                         List<org.apache.ace.log.LogDescriptor> remoteRanges)

writeDelta

protected void writeDelta(List<org.apache.ace.log.LogDescriptor> descriptors,
                          Writer writer)
                   throws IOException
Writes the difference between local and remote to a writer.

Parameters:
descriptors - A list of LogDescriptors that identifies all local log entries that need to be written.
writer - A writer to write to.
Throws:
IOException

writeLogDescriptor

protected void writeLogDescriptor(org.apache.ace.log.LogDescriptor descriptor,
                                  Writer writer)
                           throws IOException
Writes the LogEvents described by the descriptor to the writer.

Parameters:
descriptor - A LogDescriptor that identifies the events to be written.
writer - A writer to write the events to.
Throws:
IOException - Thrown when either the writer goes wrong, or there is a problem communicating with the local log store.

doPull

protected boolean doPull(URL host,
                         List<org.apache.ace.log.LogDescriptor> localRanges,
                         List<org.apache.ace.log.LogDescriptor> remoteRanges)

readLogs

protected void readLogs(BufferedReader reader)

calculateDelta

protected List<org.apache.ace.log.LogDescriptor> calculateDelta(List<org.apache.ace.log.LogDescriptor> source,
                                                                List<org.apache.ace.log.LogDescriptor> destination)
Calculates the difference between two lists of LogDescriptor. The result will contain whatever is not in destination, but is in source.


getRanges

protected List<org.apache.ace.log.LogDescriptor> getRanges(InputStream stream)
                                                    throws IOException
Throws:
IOException

getName

public String getName()
Specified by:
getName in interface org.apache.ace.log.LogSync


Copyright © 2009-2011 The Apache Software Foundation. All Rights Reserved.