net.refractions.udig.catalog.ui
Class IConnectionErrorHandler

java.lang.Object
  extended by net.refractions.udig.catalog.ui.IConnectionErrorHandler

public abstract class IConnectionErrorHandler
extends java.lang.Object

A class which is used to handle an error which occurs when attempting to connection to a service.

Connection error handlers have the following responsibilites:

Connection error handlers are contributed by extending the net.refractions.catalog.ui.connectionErrorHandler extension point.

Subclasses may overide the following methods.

Author:
Justin Deoliveira,Refractions Research Inc.,jdeolive@refractions.net

Field Summary
static java.lang.String XPID
          extension point id *
 
Constructor Summary
IConnectionErrorHandler()
           
 
Method Summary
abstract  boolean canHandle(IService service, java.lang.Throwable t)
          Determines if the handler can handle the error in question.
 boolean canRecover()
          Determines if the handler has the ability to recover from the error so that another connection may be attempted.
protected abstract  Control create(Composite parent)
           
 void createControl(Composite parent)
          Creates the control used by the handler to provide feedback / recover from the error.
 Control getControl()
           
 java.lang.String getName()
          Return the name of the handler.
 IService getService()
           
 java.lang.Throwable getThrowable()
           
 boolean isComplete()
          Determines if the handler is done handling the error, and another connection may be attempted.
 void recover(IProgressMonitor monitor)
          This method is called in the event in which a handler can recover from a connection error.
 void setName(java.lang.String name)
          Sets the name for the handler.
 void setService(IService service)
           
 void setThrowable(java.lang.Throwable t)
          Sets the error being handled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XPID

public static final java.lang.String XPID
extension point id *

See Also:
Constant Field Values
Constructor Detail

IConnectionErrorHandler

public IConnectionErrorHandler()
Method Detail

setName

public void setName(java.lang.String name)
Sets the name for the handler. This name will be used to identify the handler in cases where multiple handlers may wish to handle a single error.

Parameters:
name - The name of the handler.

getName

public java.lang.String getName()
Return the name of the handler. This name will be used to identify the handler in cases where multiple handlers may wish to handle a single error.

Returns:
The name of the handler.

setThrowable

public void setThrowable(java.lang.Throwable t)
Sets the error being handled.

Parameters:
t - The throwable object representing the error.

getThrowable

public java.lang.Throwable getThrowable()
Returns:
the error being handled.

getService

public IService getService()
Returns:
the service being connected to.

setService

public void setService(IService service)
Parameters:
service - The service being connected to.

getControl

public Control getControl()
Returns:
the control used by the handler to provide feedback / recover from the error.

createControl

public void createControl(Composite parent)
Creates the control used by the handler to provide feedback / recover from the error.

Parameters:
parent - The parent widget.

isComplete

public boolean isComplete()
Determines if the handler is done handling the error, and another connection may be attempted. If the handler does not have the ability to recover from a connection error (ie. canRecover() return false), this method should return false.

Returns:
true if the error has been handled, otherwise.

canRecover

public boolean canRecover()
Determines if the handler has the ability to recover from the error so that another connection may be attempted.

Returns:
True if the handler will try to recover, otherwise false.

recover

public void recover(IProgressMonitor monitor)
             throws java.io.IOException
This method is called in the event in which a handler can recover from a connection error. This method blocks and allows the handler to make remote connections.

Parameters:
monitor - A progress monitor.
Throws:
java.io.IOException

canHandle

public abstract boolean canHandle(IService service,
                                  java.lang.Throwable t)
Determines if the handler can handle the error in question.

Parameters:
t - The error in question.
Returns:
True if the handler can handle, otherwise false.

create

protected abstract Control create(Composite parent)
Parameters:
parent -
Returns: