| | |
| | | * The class just reads what is written to the standard error, obtains an |
| | | * formatted representation of it and then notifies the |
| | | * ProgressUpdateListeners with the formatted messages. |
| | | * |
| | | */ |
| | | public class ErrorPrintStream extends ApplicationPrintStream { |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public ErrorPrintStream() { |
| | | super(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage formatString(String s) { |
| | | return getFormattedLogError(LocalizableMessage.raw(s)); |
| | |
| | | * The class just reads what is written to the standard output, obtains an |
| | | * formatted representation of it and then notifies the |
| | | * ProgressUpdateListeners with the formatted messages. |
| | | * |
| | | */ |
| | | public class OutputPrintStream extends ApplicationPrintStream |
| | | { |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public OutputPrintStream() { |
| | | super(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | protected LocalizableMessage formatString(String s) { |
| | | return getFormattedLog(LocalizableMessage.raw(s)); |
| | |
| | | */ |
| | | protected abstract LocalizableMessage formatString(String string); |
| | | |
| | | /** |
| | | * Default constructor. |
| | | * |
| | | */ |
| | | /** Default constructor. */ |
| | | public ApplicationPrintStream() |
| | | { |
| | | super(new ByteArrayOutputStream(), true); |
| | | isFirstLine = true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void println(String msg) |
| | | { |
| | |
| | | isFirstLine = false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void write(byte[] b, int off, int len) |
| | | { |
| | |
| | | |
| | | |
| | | |
| | | /** |
| | | * Class used to add points periodically to the end of the logs. |
| | | */ |
| | | /** Class used to add points periodically to the end of the logs. */ |
| | | protected class PointAdder implements Runnable |
| | | { |
| | | private Thread t; |
| | | private boolean stopPointAdder; |
| | | private boolean pointAdderStopped; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | */ |
| | | /** Default constructor. */ |
| | | public PointAdder() |
| | | { |
| | | } |
| | | |
| | | /** |
| | | * Starts the PointAdder: points are added at the end of the logs |
| | | * periodically. |
| | | */ |
| | | /** Starts the PointAdder: points are added at the end of the logs periodically. */ |
| | | public void start() |
| | | { |
| | | LocalizableMessageBuilder mb = new LocalizableMessageBuilder(); |
| | |
| | | t.start(); |
| | | } |
| | | |
| | | /** |
| | | * Stops the PointAdder: points are no longer added at the end of the logs |
| | | * periodically. |
| | | */ |
| | | /** Stops the PointAdder: points are no longer added at the end of the logs periodically. */ |
| | | public synchronized void stop() |
| | | { |
| | | stopPointAdder = true; |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void run() |
| | | { |