org.geotoolkit.gui.headless
Class ProgressMailer

Object
  extended by ProgressController
      extended by ProgressMailer
All Implemented Interfaces:
EventListener, ProcessListener, Localized

@ThreadSafe
public class ProgressMailer
extends ProgressController

Reports progress by sending email to the specified address at regular interval.

Since:
2.0
Version:
3.19
Author:
Martin Desruisseaux (MPO, IRD, Geomatys)
Module:
display/geotk-widgets-swing (download)    View source code for this class

Constructor Summary
ProgressMailer(Session session, Address... address)
          Constructs an objects reporting progress to the specified email addresses.
ProgressMailer(String host, String address)
          Constructs an objects reporting progress to the specified email address.
 
Method Summary
 void completed()
          Sends an emails saying that the operation finished.
 void exceptionOccurred(Throwable exception)
          Send an exception stack trace by email.
 long getTimeInterval()
          Returns the time laps (in milliseconds) between two emails.
 void setProgress(float percent)
          Notifies progress.
 void setTimeInterval(long interval)
          Sets the time laps (in milliseconds) between two emails.
 void started()
          Sends an email saying that the operation started.
 void warningOccurred(String source, String location, String warning)
          Sends a warning by email.
 
Methods inherited from class ProgressController
cancel, completed, failed, getLocale, getProgress, getTask, isCanceled, progressing, setTask, started
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProgressMailer

public ProgressMailer(String host,
                      String address)
               throws AddressException
Constructs an objects reporting progress to the specified email address.

Parameters:
host - The server to use for sending emails.
address - Email address where to send progress reports.
Throws:
AddressException - if the specified address use an invalid syntax.

ProgressMailer

public ProgressMailer(Session session,
                      Address... address)
Constructs an objects reporting progress to the specified email addresses.

Parameters:
session - Session to use for sending emails.
address - Email address where to send progress reports.
Method Detail

getTimeInterval

public long getTimeInterval()
Returns the time laps (in milliseconds) between two emails.

Returns:
The current time laps in milliseconds.

setTimeInterval

public void setTimeInterval(long interval)
Sets the time laps (in milliseconds) between two emails. The default value is 3 hours.

Parameters:
interval - The new time laps in milliseconds.

started

public void started()
Sends an email saying that the operation started.

Specified by:
started in class ProgressController

setProgress

public void setProgress(float percent)
Notifies progress. This method will send an email only if at least the amount of time specified by setTimeInterval(long) is elapsed since the last email.

Overrides:
setProgress in class ProgressController
Parameters:
percent - The progress as a value between 0 and 100 inclusive.

completed

public void completed()
Sends an emails saying that the operation finished.

Specified by:
completed in class ProgressController

warningOccurred

public void warningOccurred(String source,
                            String location,
                            String warning)
Sends a warning by email.

Specified by:
warningOccurred in class ProgressController
Parameters:
source - Name of the warning source, or null if none. This is typically the filename in process of being parsed or the URL of the data being processed
location - Text to write on the left side of the warning message, or null if none. This is typically the line number where the error occurred in the source file or the feature ID of the feature that produced the message
warning - The warning message.

exceptionOccurred

public void exceptionOccurred(Throwable exception)
Send an exception stack trace by email.

Specified by:
exceptionOccurred in class ProgressController
Parameters:
exception - The exception to report.


Copyright © 2009-2012 Geotoolkit.org. All Rights Reserved.