org.geotools.gui.headless
Class ProgressMailer

Object
  extended by ProgressMailer
All Implemented Interfaces:
ProgressListener

public class ProgressMailer
extends Object
implements ProgressListener

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

Since:
2.0
Author:
Martin Desruisseaux (PMO, IRD)
Module:

Constructor Summary
ProgressMailer(Session session, Address[] address)
          Creates an objects reporting progress to the specified email adresses.
ProgressMailer(String host, String address)
          Creates an objects reporting progress to the specified email address.
 
Method Summary
 void complete()
          Send an emails saying that the operation finished.
 void dispose()
          Releases any resource used by this object.
 void exceptionOccurred(Throwable exception)
          Send an exception stack trace by email.
 String getDescription()
          Deprecated. Replaced by getTask().
 float getProgress()
           
 InternationalString getTask()
          
 long getTimeInterval()
          Returns the time laps (in milliseconds) between two emails.
 boolean isCanceled()
          
 void progress(float percent)
          Notifies progress.
 void setCanceled(boolean canceled)
          
 void setDescription(String description)
          Deprecated. Replaced by setTask(org.opengis.util.InternationalString).
 void setTask(InternationalString task)
          
 void setTimeInterval(long interval)
          Set the time laps (in milliseconds) between two emails.
 void started()
          Send an emails saying that the operation started.
 void warningOccurred(String source, String margin, String warning)
          Send a warning by email.
 
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
Creates an objects reporting progress to the specified email address.

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

ProgressMailer

public ProgressMailer(Session session,
                      Address[] address)
Creates an objects reporting progress to the specified email adresses.

Parameters:
session - Session to use for sending emails.
address -
Method Detail

getTimeInterval

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


setTimeInterval

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


getDescription

public String getDescription()
Deprecated. Replaced by getTask().

Specified by:
getDescription in interface ProgressListener

setDescription

public void setDescription(String description)
Deprecated. Replaced by setTask(org.opengis.util.InternationalString).

Specified by:
setDescription in interface ProgressListener

setTask

public void setTask(InternationalString task)

Specified by:
setTask in interface ProgressListener
Since:
2.3

getTask

public InternationalString getTask()

Specified by:
getTask in interface ProgressListener
Since:
2.3

started

public void started()
Send an emails saying that the operation started.

Specified by:
started in interface ProgressListener

progress

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

Specified by:
progress in interface ProgressListener

getProgress

public float getProgress()
Specified by:
getProgress in interface ProgressListener

complete

public void complete()
Send an emails saying that the operation finished.

Specified by:
complete in interface ProgressListener

dispose

public void dispose()
Releases any resource used by this object.

Specified by:
dispose in interface ProgressListener

isCanceled

public boolean isCanceled()

Specified by:
isCanceled in interface ProgressListener

setCanceled

public void setCanceled(boolean canceled)

Specified by:
setCanceled in interface ProgressListener

warningOccurred

public void warningOccurred(String source,
                            String margin,
                            String warning)
Send a warning by email.

Specified by:
warningOccurred in interface ProgressListener

exceptionOccurred

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

Specified by:
exceptionOccurred in interface ProgressListener


Copyright © 1996-2009 Geotools. All Rights Reserved.